Dark Horse Programmer-C language Notes

Source: Internet
Author: User

Android training, Java training, iOS training,. NET training look forward to communicating with you!

A. C Language study notes

Thank the Dark Horse to provide a platform, thank teachers!

  My first C language program:

The first step in learning a language is to first export "Hello World", which originated in 1972, and Bell Labs researcher Brian Kernighan is writing "B language Tutorials and guidance (Tutorial Introduction to the Language b First Use (program), this is the earliest known record of the use of Hello and world in computer works. Later, in 1978, he and Dennis Ritchie co-authored the C-Language Bible "The C programming Language", the use of "Hello, world" sentence, as the opening of the first program. In this program, the output of "Hello, world" is all lowercase, no exclamation point, a comma after a space. Although the original format was rarely passed down after that, it was customary to greet the world with the greetings and personal feelings could be a tribute.  

1 #include <stdio.h>23int main (intconstChar * argv []) {4  5      printf ("HelloWorld");   Enter Hello World67      return0;     8 }

  

  in the C language, The function declaration is in the Header.h file, and the implementation of the function is in the ***.c file.

1. You can import the ". h" header file when using the function, and if you import the ". C" File There will be a duplicate function error

  (Note: You can use the angle brackets "<stdio.h>" and the double quotation mark " stdio.h"when importing the header file of the system itself, but to import a header file that is not the system itself, double quotation marks are used, for example:"MyTest.h" )

  

  2. Condition Judgment, Example: if (a = = 3) It is best to write if (3 = = a), if you omit a "=" in the code, then the compiler will prompt, and the previous type of compilation passed,

The result assigns a value of 3 to a.

  

3. Array, array is a constant, can only be initialized when the array is defined, otherwise you cannot assign a value to the array at a later stage.

①: The address of the array is the byte address of the first element in the array, for example:

1 CharA [] = {'I','T' };2 /*defines an array of type char, named A, that holds two elements in the array*/3 4 Address:5 1. printf"%d", &a[0]);//output address is 16382126 7 2. printf ("%d", &a);//output address is 1638212

the difference between 4.printf and puts is the same as the output function:

①printf can output multiple elements at the same time, separated by commas, but the put can only output a single element at a time

②printf output is required to add "\ n" to wrap, and puts to wrap.

int main (int argc,const char * argv[]) {    printf ("Black Horse, Hello! \ n ");    Puts ("Black Horse, Hello!" ");   }
/* Output is changed the line of "Dark Horse, Hello!" "*/

Thank the Dark Horse to provide a platform, I hope that they can make unremitting efforts!

Dark Horse Programmer-C language Notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.