searchsanjaysharma
asked on
How to read a string in c dynamically,
void main()
{
char str[2000];
}
Other way could be
void main()
{
char *str=(char*)malloc(sizeof( char)*(no. of characters));
}
How can i get the no. of characters in c at runtime.
Is there any way to input a string dynamically without fixing the size.
{
char str[2000];
}
Other way could be
void main()
{
char *str=(char*)malloc(sizeof(
}
How can i get the no. of characters in c at runtime.
Is there any way to input a string dynamically without fixing the size.
What do you mean by "input"? Input from where? Someone typing on the console, etc?
The norm is for strings to be null-terminated. If so:
unsigned int x = strlen(str);
unsigned int x = strlen(str);
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
tx