Showing posts with label functions. Show all posts
Showing posts with label functions. Show all posts

11 May 2012

Coding Functions in 'C'

In order to create and use a function in 'C', the programmer must provide three things which have matching descriptions:

  1. A function prototype - describes the structure of the function to the compiler.
  2. A function call - passes program control to the function.
  3. A function header - begins the program code of the function.
Function Prototype

A prototype shows the name of the function

08 May 2012

String Functions in 'C' (#include<stdio.h>)

The 'C' language provides a number of functions which help when handling strings.

strcat(string1, string2);

This function concatenates (adds to the end of) string2 to string1.
char string1[30] = "First String", string2[15] = "Second String";
strcat(string1, string2);
printf("%s", string1); // will print First StringSecond String
strlen(string);