何时在scanf使用&

#include <stdio.h>

int main(void){
    int age;
    float assets;
    char pet[30];        // string

    printf(Enter your age, assets, and favorite pet.\n);
    scanf(%d %f, &age, &assets); // use the & here
    scanf(%s, pet);              // no & for char array
    printf(%d $%.2f %s\n, age, assets, pet);

    return 0;
}

相关文章

for遍历数组
。。。
声明一个计数循环
咕咕咕
#include <stdio.h> int main (void) { printf (&quo...