adplus-dvertising
frame-decoration

Question

What is the output of this program?

#include <stdio.h>
#include  <stdlib.h>
int main()
{
  int i;
  char *ptr;
  char *fun();
  ptr = fun();
  printf(" %s", ptr);
  return 0;
}

char *fun()
{
  char disk[30];
  strcpy(disk, "compsciedu");
  printf("%s ",disk);
  return disk;
}

a.

compsciedu

b.

Compilation error

c.

compsciedu compsciedu

d.

garbage value

Posted under C Programming

Answer: (a).compsciedu

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?