Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFCCCC
#include <stdio.h>
extern char *strchr();

char *(*fp) ();

int main(void) {  
  char *c;
  fp = strchr;
  c = fp(12,2);
  printf("%s\n",c);

}

Compliant Solution: (function pointers)

Code Block
bgColor#ccccff

extern char *strchr();#include <string.h>

char *(*fp) (cjar *,int);

int main(void) {  
  char *c;
  fp = strchr;
  c = fp(12,2"Hello",'H');
  printf("%s\n",c);

}

Non-Compliant Code Example: (variadic functions)

...