-
include header files
main ( *main function*.)
char a[100]="c programming",b="language", * defines a char-type array a with a length of 100 and its contents as"c programming", which defines a char-type array b with the contents of"language"There is a mistake here, each line should end with a semicolon, not a comma*
char*p1,p2;*According to the context, this should be to define two char* variables p1 and p2, but this is not possible, the compiler will think that it is a char* variable p1 and char variable p2, this statement is better to be written separately, write as: char* p1; char* p2; */
p1=a;Assign the first address of array a to p1
p2=b;Assign the first address of array b to p2
while(*p1!="\0"* Execute the following loop when the character p1 points to is not 0, there is also a problem here, 0 is a character and not a string, so it should be enclosed in single quotes, not double quotes*
printf("%c",*p1);*Print the characters pointed to by P1 on the screen, there is also an error here, the closing half bracket and semicolon should be half-width English punctuation, not Chinese full-width punctuation*
p1++;Change p1 to point to the next character in the array, where the semicolon is also double-width characters*
printf("-"*Print "-" on the screen, where the opening parenthesis cannot be in full-width characters, and a semicolon * should be added at the end of the line
while(*p2!="\0"*This loop is the same as the previous one, printing the contents of the b array, here you still can't use double quotes, you have to change it to single quotes*
Use the left half of the curly braces*
printf("%c",*p2);
p2++ * does not have a semicolon at the end of the line, and should be added with *
printf("");Print line breaks
Added: When C stores a string, it automatically adds a 0 character to the end of the string (0 is a character, not two) to represent the end of the character, so what is actually stored in array A is"c programming\0", b is stored"language\0", so the condition for determining the end of two while loops in the program is to encounter the 0 character.
-
The result is: c programming
language
Roughly speaking:
a[100]="c programming",b="language";
Define two arrays a, b; and assign values separately"c programming","language".
2. char*p1,p2;
p1=a;p2=b;
Define two pointer variables p1 and p2, and assign the first addresses of the two arrays a and b respectively, that is'c',"l"The memory address of .
3. while(*p1!="\0")
printf("%c",*p1);
p1++;Output the content that p1 refers to character by character, not the end of the word (.)'\0'), to point p1 to the next character, e.g., p1 from pointing to 'c' to pointing to ' and then 'p'','r'...
4.The same as 3 below
-
Pointer p1 points to a, pointer p2 points to b, and the first loop prints the string in a, *p1!='\0'As the end is because the strings all have one'\0'As an end. '\0'It's 0, and if it encounters 0, it exits.
The second loop prints out the string in b, as above.
-
High-level languages are divided into compiled and interpreted languages.
1.Compilation-based languages use specialized compilers to compile high-level language sources** into machine code that can be executed by the platform's hardware at one time for a specific platform, and package it into a format that can be recognized by the platform as an executable program.
Existing C, C++, etc. are compiled languages.
2.Interpreted languages use specialized interpreters to interpret the source program line by line into platform-specific machine code and execute it immediately.
Python and the like are interpreted languages.
-
C is a compiled language.
char *p;
uchar log_type; >>>More
main() [main function main program].
int i,j,k;【Define integer data i,j,k】for(i=1; i<=6;i++) main loop, i from 1 to 6, increasing to 1] for(j=1; j<=20-2*i;j++) subcycle, j from 1 to 20-2*i >>>More
It's a shame to ask your question, one is the development environment, the other is the language, what's the difference, you're laughing to death.
Question 1: pt1=&a;pt2=&b;pt1 and pt2 are not defined, years are defined as. >>>More
This problem requires understanding that the system allocates memory to static variables when compiling, and the memory units occupied by them are not released after the function call ends, that is, the value of the variable is the value of the previous function call at the next function call. >>>More