In C, if you pass an array as an argument to a function, what actually gets passed?
What will be the output of the program?
#include
int main()
{
viod fun( int, int[]);
int arr[] = {1, 2, 3, 4};
int i;
fun (4, arr);
for (i=0; i<4; i++)
printf(%d, arr[i]);
return 0;
}
void fun(int n, int arr[])
{
int *p=0;
int i=0;
while(i++ < n)
p = &arr[i];
*p=0;
}
1 Crore+ students have signed up on EduRev. Have you? Download the App |
What will be the output of the program if the array begins 1200 in memory?
#include
int main()
{
Int arr[]={2, 3, 4, 1, 6};
printf(%u, %u, %u , arr, &arr[0], &arr);
return 0;
}
Which of the following statements are correct about an array?
1: The array int num [26]; can store 26 elements.
2: The expression num [1] designates the very first element in the array.
3: It is necessary to initialize the array at the time of declaration.
4: The declaration num [SIZE] is allowed if SIZE is a macro.
Which of the following function is used to find the first occurrence of a given string in another string?
What will be the output of the program in 16-bit platform (Turbo C under DOS)?
#include
Int main()
{
Printf(%d, %d, %d, sizeof(3.0f), sizeof(3)), sizeof(3.0);
Return 0;
}
Which of the following statements are correct ?
1:A string is a collection of characters terminated by .
2:The format specifier %s is used to print a string.
3: The length of the string can be obtained by strlen().
4:The pointer CANNOT work on string.
Point out the error in the program?
#incluse
int main()
{
struct emp
{
char name[20];
float sal;
};
struct emp e[10];
int i;
for(i=0; i<=9; i++)
scanf(“%s %f e[i].name, &e[i].sal);
return 0;
}
What is the similarity between a structure, union and enumeration?
What will be the output of the program?
#include
int main()
{
enum days {MON=-1, TUE, WED=6, THU, FRI, SAT};
printf("%d, %d, %d, %d, %d, %d ", MON, TUE, WED, THU, FRI, SAT);
return 0;
}
What will be the output of the program ?
#include
struct course
{
int courseno;
char coursename[25];
};
int main()
{
struct course c[] = { {102,Java},
{ 103, PHP},
{104, DotNet} };
printf(%d, c[1].courseno);
printf(%sm, (*(c+2)).coursename);
return 0;
}
Point out the error in the program
#include
int main()
{
int I;
#if A
printf(Enter any number:);
scanf(%d, &i);
#elif B
printf( The number is odd);
return 0;
}
What do the following declaration signify?i
nt *ptr[30];
Which of the following function is correct that finds the length of a string?
85 docs|57 tests
|
85 docs|57 tests
|