Computer Science, asked by been3271, 9 months ago

Find the output of following C 3 points
program code
char c[] = "C Program";
char *p = c;
printf("%s", p+4-1);
O Program
Orogram
gram
O No output will printed​

Answers

Answered by AmritanshuKesharwani
0

Answer:

rogram

Explanation:

Code is here:

  1. #include<stdio.h>
  2. int main()
  3. {
  4. char c[] = "C Program";
  5. char *p = c;
  6. printf("%s", p+4-1);
  7. }

I want to tell you that you are violating the rules of Arrays in C programming language. According to the rules of C programming language of Arrays.

First of all, we have to know about the arrays. So, an array is a collection of same kind of data. Arrays of characters are string.

  • Characters are written in single cout '_'.
  • strings are written in double cout "_".

→ char name = 'K';

→ char*name = "Kesharwani";

Now, how can I declare the arrays in C programming language? So, here is the answer of your best question. To declare the arrays in C programming language. First of all, we have to write datatype then * after that array name and after that we have to write the size of the array.

Now, how can I initialise the arrays in C programming language? So, here is the answer of your best question. To initialise the arrays in C programming language. First of all, we have to write array name then location of the array after that = equal sign and after that we have to write the value of the array.

These are some of the arrays which you should look and follow these concepts of arrays.

→ int nums [ ] = { 1, 2, 3, 4, 5} ;

→ float nums [ ] = { 1.0, 2.0, 3.0, 4.0, 5.0} ;

→ char grades [ ] = { 'A', 'B', 'C'} ;

→ char*fruits [ ] = {"Apple", "Banana", "Grapes"} ;

→ char*emogies [ ] = {u8"emogi", u8"emoji", u8"emoji"} ;

→ char name [ ] = {'a', 'm', 'r', 'i', 't'} ;

Note: emoji means a face of smile which you use in your WhatsApp chat.

#Be Brainly

Attachments:
Similar questions