gpt4 book ai didi

c - 如何在 C 中打印

转载 作者:太空狗 更新时间:2023-10-29 16:26:22 26 4
gpt4 key购买 nike

我是 C 语言的初学者,事实上这是我的第一个测试程序。

我实际上不知道如何将这个数字打印到终端。

#include <stdio.h>

int addNumbers(int a, int b)
{
int sum = a + b;
return sum;
}

int main(void)
{
int a = 4;
int b = 7;

printf(addNumbers(a,b));
return 0;
}

我敢肯定,在 Java 中,我只需将 printf 替换为 System.out 就可以了。我之前尝试搜索答案,但如果您不知道要搜索什么,就很难找到答案。

最佳答案

试试这个:

printf("%d", addNumber(a,b))

这是 documentation for printf .

关于c - 如何在 C 中打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2162758/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com