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() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above
Sorting entire link list using selection sort and insertion sort and calculating their time complexity
1 Answers Infosys, Microsoft, NetApp,
can u give me the c codings for converting a string into the hexa decimal form......
main() { char a[4]="HELLO"; printf("%s",a); }
Write a program to check whether the number is prime and also check if it there i n fibonacci series, then return true otherwise return false
how to delete an element in an array
Is the following code legal? struct a { int x; struct a b; }
void main() { char a[]="12345\0"; int i=strlen(a); printf("here in 3 %d\n",++i); }
main() { int i=5,j=6,z; printf("%d",i+++j); }
Write a complete program that consists of a function that can receive two numbers from a user (M and N) as a parameter. Then print all the numbers between the two numbers including the number itself. If the value of M is smaller than N, print the numbers in ascending flow. If the value of M is bigger than N, print the numbers in descending flow. may i know how the coding look like?
int i; main(){ int t; for ( t=4;scanf("%d",&i)-t;printf("%d\n",i)) printf("%d--",t--); } // If the inputs are 0,1,2,3 find the o/p
#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }