Skip to content

Latest commit

 

History

History
13 lines (12 loc) · 277 Bytes

c.md

File metadata and controls

13 lines (12 loc) · 277 Bytes

Returning a String from a function

In C, Strings are arrays of char. We need to return a pointer to the first element of the string.

const char* hello() {
  return "Hello World";
}

int main(int argc, const char * argv[]) {
  printf("%s", hello());
  return 0;
}