main( )
{
char *q;
int j;
for (j=0; j<3; j++) scanf(“%s” ,(q+j));
for (j=0; j<3; j++) printf(“%c” ,*(q+j));
for (j=0; j<3; j++) printf(“%s” ,(q+j));
}
Answer / susie
Answer :
Explanation:
Here we have only one pointer to type char and since we take
input in the same pointer thus we keep writing over in the
same location, each time shifting the pointer value by 1.
Suppose the inputs are MOUSE, TRACK and VIRTUAL. Then for
the first input suppose the pointer starts at location 100
then the input one is stored as
M
O
U
S
E
\0
When the second input is given the pointer is incremented as
j value becomes 1, so the input is filled in memory starting
from 101.
M
T
R
A
C
K
\0
The third input starts filling from the location 102
M
T
V
I
R
T
U
A
L
\0
This is the final value stored .
The first printf prints the values at the position q,
q+1 and q+2 = M T V
The second printf prints three strings starting from
locations q, q+1, q+2
i.e MTVIRTUAL, TVIRTUAL and VIRTUAL.
| Is This Answer Correct ? | 2 Yes | 0 No |
main() { extern i; printf("%d\n",i); { int i=20; printf("%d\n",i); } }
Link list in reverse order.
How to use power function under linux environment.eg : for(i=1;i<=n;i++){ pow(-1,i-1)} since it alerts undefined reference to 'pow'.
How to reverse a String without using C functions ?
33 Answers Matrix, TCS, Wipro,
1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.
why the range of an unsigned integer is double almost than the signed integer.
Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.
Write a function to find the depth of a binary tree.
13 Answers Adobe, Amazon, EFI, Imagination Technologies,
Can you send Code for Run Length Encoding Of BMP Image in C Language in linux(i.e Compression and Decompression) ?
how can i cast a char type array to an int type array
write a c program to print magic square of order n when n>3 and n is odd?
write a origram swaoing valu without 3rd variable