Pointers
- What type of initialization is needed for the segment “p[3] = ‘3’;” to work?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
char p[] = “Interview!”;
- What is the syntax for constant pointer to address (i.e., fixed pointer address)?
-
View Hint View Answer Discuss in Forum
NA
Correct Option: C
<type> * const <name>
- Calling a function fun with num an array variable num[3] where num is an array, is equivalent to __________.
-
View Hint View Answer Discuss in Forum
NA
Correct Option: D
Option A, B and C is equivalent.
- What will be the output of the following C code?
#include <stdio.h>
void main()
{
char str[] = "WELCOME";
str++;
printf("%c\n", *str);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
Compilation Error
main.c: In function ‘main’:
main.c:5:12: error: lvalue required as increment operand
str++;
- What will be the output of the following C code?
#include <stdio.h>
void count(char *ptr)
{
ptr++;
ptr[3] = 'S';
}
void main()
{
char str[] = "AJIT";
count(str);
printf("%c\n", *str);
}
-
View Hint View Answer Discuss in Forum
NA
Correct Option: A
A