Describe input and output of strings in C program.
1. #include<stdio.h>
2. #include<conio.h>
3. main()
4. {
5. char a[10];
6. clrscr();
7. gets(a);
8. puts(a);
9. getch();
10.}
From
the upper example in line 7 the gets() function is use for the input a string
and in line 8 the puts() function is use
for the output a string.
What are the different forms of main statement in C
language?
int main(void) or int main()
int main(int argc,
char **argv)
int main(int argc, char *argv[])
void main()
How can an array be explicitly initialized at run time?
An array can also be explicitly initialized at run time. For
ex – consider the following segment of a C program.
for(i=0;i<10;i++)
{
scanf(" %d ", &x[i] );
}
Above example will initialize array elements with the values
entered through the keyboard. In the run time initialization of the arrays
looping statements are almost compulsory. Looping statements are used to
initialize the values of the arrays one by one by using assignment operator or
through the keyboard by the user.