= C Codes = == Hello World == {{{#!C /* hello.c: display a message on the screen */ #include int main(){ printf("hello, C world\n"); return 0; } }}} * Text between /* and */ are comments. * '''#include ''' to load the header file. * There are many header files in the standard C library. http://en.wikipedia.org/wiki/C_standard_library * Program always begins with '''main()''' function. * '''main()''' returns a integer. === Compile with GNU C === {{{[tulaneID@cypress1 ~]$ gcc hello.c}}} === Compile with Intel C === {{{[tulaneID@cypress1 ~]$ icc hello.c}}} == Links for Tutorial == * [[http://en.wikibooks.org/wiki/C_Programming | wikibooks ]] == Examples of Jobscript == {{{#!sh #!/bin/bash #SBATCH --job-name=HelloC #SBATCH --qos=normal #SBATCH --time=0-00:10:00 ### Wall clock time limit in Days-HH:MM:SS #SBATCH --nodes=1 ### Node count required for the job #SBATCH --ntasks-per-node=1 ### Nuber of tasks to be launched per Node echo Start Job pwd cat $SLURM_JOB_NODELIST ./a.out echo End job }}} == Parallel C == * [[cypress/Programming/Cexamples/OpenMp|OpenMP examples in C]] * [[cypress/Programming/Cexamples/Mpi|MPI examples in C]] == More Examples == * Approximate Pi * !Heat/Mass Transfer * Stokes Flow In a Cavity * Particle Strength Exchange Method