c Language - Functions
Catalog
1. Simple introductory functions
1. Write a function to find the maximum of two integers.
2. Write a function to exchange the contents of two integer variables.
2. Parameters of functions
1. Actual parameters (arguments)
2. Formal parameters (formal parameters)
3. Analysis of the actual and formal parameters of the first two func ...
Posted by aeboi80 on Mon, 24 Jan 2022 20:44:43 +0100
Chapter 3 data and C (notes and assignments)
3.1 example program
platinum.c procedure
/* platinum.c -- your weight in platinum */
#include<stdio.h>
int main(void)
{
float weight; /*Your weight*/
float value; /*Platinum price of equal weight*/
printf("Are you worth your weight in platinum?\n");
printf("Let's check it out.\n");
printf("Please enter your weight in pounds:");
...
Posted by php4om on Mon, 24 Jan 2022 20:38:30 +0100
[C language] judge and output prime numbers (Trial Division)
This is a programming topic I like very much. Don't underestimate this problem. It seems simple, but it's actually mysterious. Since this is an introduction to C language, it only introduces the simplest and easiest way to think of: trial division. But even the trial division has changed a lot.
To understand trial division, you must first know ...
Posted by skroks609 on Mon, 24 Jan 2022 18:09:28 +0100
Quick view of C language -- 3. Branch and loop statements and functions
1, Branch and loop statements
1. Concept of statement
In fact, the sentence concept in C language is similar to that in natural language; It is divided into five categories
Control statements in C language can be divided into the following three categories
1.
Conditional judgment statements are also called branch statemen ...
Posted by mvijfwinkel on Mon, 24 Jan 2022 12:54:55 +0100
String function and memory function
This chapter focuses on the use and precautions of library functions dealing with characters and strings
The processing of characters and strings in C language is very frequent,
However, C language itself has no string type. Strings are usually placed in constant strings or character arrays.
String constants apply to string functions that ...
Posted by gelwa on Mon, 24 Jan 2022 12:12:13 +0100
C language learning notes 7
function
1. What is the function
2. Library function
3. User defined functions
4. Function parameters
5. Function call
6. Nested call and chained access of functions
7. Declaration and definition of functions
8. Function recursion
catalogue
function
Custom functions:
Parameters of function
Function call:
practice:
Nested calls ...
Posted by mcog_esteban on Mon, 24 Jan 2022 08:39:45 +0100
PAT grade B 1080 MOOC final score (25 points) c language test point analysis
First of all, let's talk about the last test point. It should be noted that the final score is a rounded integer, that is to say, the scores of 98.6 and 98.7 are the same. It's really disgusting and made me work for a long time.
1. All data can be int, and the rounding can be increased by 0.5 and then forcibly converted to int
2. Since th ...
Posted by collette on Mon, 24 Jan 2022 01:47:57 +0100
Pointer written test questions
Question 1:
int main()
{
int a[5] = { 1, 2, 3, 4, 5 };
int *ptr = (int *)(&a + 1);
printf( "%d,%d", *(a + 1), *(ptr - 1));
return 0;
}
//What is the result of the program?
Resolution:
1.a has five elements: 1, 2, 3, 4 and 5
2. Take out the address of a + 1, skip the entire array, and then forcibly convert it to the addr ...
Posted by amazing on Sun, 23 Jan 2022 20:47:16 +0100
Relevant bit segment, structure, Consortium
#Foreword
There are two similar structures in C language, which are structure and union. Today, let's take a look at the relevant contents of these two structures.
#Structure
1. Declaration of structure
The declaration of structure is made with struct keyword. The specific code is as follows:
typedef struct Stu{
char name[20];
int ...
Posted by tjodolv on Sun, 23 Jan 2022 19:47:46 +0100
Note: PAT-B1032 - which is the best excavator technology
PAT-B1032 - which excavator technology is better
Title (20 points)
In order to prove which excavator technology is better, PAT organized an excavator skills competition. Now please count the school with the strongest technology according to the competition results.
input
Enter a positive integer N that does not exceed 10 * * 5 on line 1, th ...
Posted by pbarney on Sun, 23 Jan 2022 17:07:10 +0100