Interview Questions on C - Arrays
1. What is Array?
Array is collections of similar data types of elements.
2. How to declare an array?
Syn :- datatype arrayname [size];
Ex :- int a;
3. How to access last position of element in array?
By using position value.
Arrayname[size -1 ];
4. Write a matrix addition programm?
See C Programs Page
5. How to declare multi dimentional arrays?
Syn :- datatype array_name[size1][size2];
6. How to find size of an array?
By using size of operator.
Ex :- sizeof(arr1);
1. Explain about strings?
Def :- String is collection of charrecters.
the last character of the string is null or ‘\0’.
We can represent the string by using character array.
Syn :- char str1=”Hello world”;
Here by default the last character would be ‘\0’.
2. How to print string in printf statement?
By using ‘%s’.
3. How to converta numbet to string?
4. How to Convert a number to string?
5. How to find the length of the String?
Returns the length of string s1.
6. How to copy from one string to another string?
Copies string s2 into string s1.
7. How to combine or concat two strings?
Concatenates string s2 onto the end of string s1.
8. Write a C program to reverse the string?
See C Programs