+ 2

What is meant by char *message[10]={"hello", "world"};

Explain me how can we access these stringa by pointer and is it right statement in c language?

23rd Jun 2019, 7:05 PM
Gaurav Rawat
Gaurav Rawat - avatar
6 ответов
+ 12
Yes this statement is absolutely right. Message is char pointer which has 10bytes allocated. You can access hello as first member of the array, message[0].and world can be accessed as message[1]. Pointers are a challenging🙂
24th Jun 2019, 3:02 AM
Manoj
Manoj - avatar
+ 1
How can we access them and print??
23rd Jun 2019, 7:13 PM
Gaurav Rawat
Gaurav Rawat - avatar
+ 1
What if i want print only 'h' character from that array??
23rd Jun 2019, 7:24 PM
Gaurav Rawat
Gaurav Rawat - avatar
+ 1
Thank you kaimi You helped me alot Thanks ☺☺
23rd Jun 2019, 7:30 PM
Gaurav Rawat
Gaurav Rawat - avatar
+ 1
One more question that *message [10] create normal array like message[10] and point to first character address??
23rd Jun 2019, 7:36 PM
Gaurav Rawat
Gaurav Rawat - avatar
+ 1
Its create 10 elements of character array but i store it 2d array elements how?
23rd Jun 2019, 7:52 PM
Gaurav Rawat
Gaurav Rawat - avatar