C – (pointer transfer parameter) primary pointer transfer parameter

Time:2022-5-25
#define _CRT_SECURE_NO_WARNINGS 1

#include
#include
#include
void print(int* ptr, int sz)
{
    int i = 0;
    for (i = 0; i < sz; i++)
    {
        printf("%d ", *(ptr + i));
    }

}
int main()
{
    int arr[10] = { 1,2,3,4,5,6,7,8,9,10 };
    int* p = arr;
    int sz = sizeof(arr) / sizeof(arr[0]);

    //When the pointer is passed to the first level, the parameter of the pointer is passed to the first level
    print(p,sz);

    char ch = 'w';
    char* p1 = &ch;
    test(&ch);
    test(p1);

    return 0;
}

 

Recommended Today

How to configure Jenkins through yaml file

Install Jenkins docker run -d –name jenkins-master -p 8080:8080 -p 50000:50000 -v /var/jenkins_home:/var/jenkins_home -v /etc/localtime:/etc/localtime –restart=always jenkinsci/blueocean After successful startup, log in to Jenkins and the initial password path is:/var/jenkins_home/secrets/initialAdminPassword。And install Jenkins configuration as code (a.k.a. jcasc) plugin. The jcasc plug-in supports the use of yaml filesjenkins.yamlTo configure the Jenkins instance, it does not support […]