编程时我遇到了一个不寻常的错误.当我在循环中初始化一个整数时,有时它表示该表达式无效,但有时它接受它.这是我的代码,它给出了错误:
int pow(int x,int n);
int main()
{
int x,n,result;
printf("Enter a number:\n");
scanf("%d",&x);
printf("Enter its power:\n");
scanf("%d",&n);
result=pow(x,n);
printf("Result is %d\n",result);
getch();
return 0;
}
int pow(int x,int n)
{
for(int i=1;i<n;i++) //<-- here it says that declaration syntax error
x=x*i;
return x;
}
Run Code Online (Sandbox Code Playgroud)
当我改变它时:
int pow(int x,int n)
{
int i;
for(i=1;i<n;i++)
x=x*i;
return x;
}
Run Code Online (Sandbox Code Playgroud) 为什么我们在C中使用整数?
#include<stdio.h>
int main()
{
char c=10;
printf("%d",c);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
与以下相同:
#include<stdio.h>
int main()
{
int c=10;
printf("%d",c);
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我对c ++很新,并且模糊编程和面向函数编程之间的区别很困惑.我从未完成模块化编程,所以我只知道模块的定义,它包含函数.所以顺序之间有什么区别(函数 -面向语言)和模块化编程?提前感谢.
编辑: 我正在阅读关于C++的OOP.It开始类似于非结构化编程,而不是模块化编程,最后是OOP,而不是结构化编程的基本概念.
我是汇编语言的新手.我正在阅读关于MIPS架构的文章,我坚持一个概念.
MIPS有四个参数寄存器$ a0,$ a1,$ a2和$ a3.这些专用寄存器用于保存从调用者过程传递给被调用者过程的参数.
如果函数有超过4个参数会发生什么,因为只有四个寄存器来保存参数?提前致谢.
给定的是字节可寻址计算机的内存快照.如果机器是大端和Little Endian,$16在执行指令后将加载到寄存器中的内容lw $16, 24($17).注册$17包含200.

根据我的说法,(224-227)无论Little Endian还是Big Endian,都会从内存中复制四个字节,如果机器是Big Endian,那么它们将被原样复制到寄存器中.
如果机器是Little Endian,则将反转,然后复制到寄存器.
如果我对这个概念有误,请指导我.
我无法理解方向标志是如何工作的x86.在我的演讲中的文本说,它递增或递减的源或目的寄存器但这没有任何意义与它的名字.有人可以解释它的作用吗?
我正在从这里学习插入异常.以下数据写在其中,
插入异常
如果在没有其他属性的情况下无法将某些属性插入数据库,则会发生插入异常.例如,这与删除异常相反 - 除非我们至少有一名学生注册该课程,否则我们无法添加新课程.
StudentNum CourseNum Student Name Address Course
S21 9201 Jones Edinburgh Accounts
S21 9267 Jones Edinburgh Accounts
S24 9267 Smith Glasgow physics
S30 9201 Richards Manchester Computing
S30 9322 Richards Manchester Maths
Run Code Online (Sandbox Code Playgroud)
我不理解这个概念.为什么我们需要一名学生注册该课程才能存在?
提前致谢
为了使字符串成为空字符串我写了这个:
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[15]="fahad uddin";
strlen(str);
puts(str);
for(int i=0;str[i]!='\0';i++)
strcpy(&str[i],"\0") ;
puts(str);
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在此之前,我试过:
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main()
{
char str[15]="fahad uddin";
strlen(str);
puts(str);
for(int i=0;str[i]!='\0';i++,strcpy(&str[i],"\0"))
;
puts(str);
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在第一个示例中,程序运行正常,而在第二个示例中,它打印字符串的第一个字母(在此示例中为F).为什么是这样?
在阅读一本名为"Let us C"的书时,我读到了一个showbit()可以显示数字位的函数.没有提到任何特殊的头文件.在互联网上搜索它并没有发现任何有用的东西.有这样的功能吗?我想要打印十进制数的二进制数.否则请给我一个替换功能.谢谢
如果我必须找到一个字符串名称"Akito"并且它位于表foo中,那么以下是正常的过程,
select * from foo where `name = 'Akito'`
Run Code Online (Sandbox Code Playgroud)
我试着检查它的两个变种,
工作得很好
select * from foo where name = 'Akito '
Run Code Online (Sandbox Code Playgroud)
工作不好
select * from foo where name = ' Akito'
Run Code Online (Sandbox Code Playgroud)
任何人都可以解释为什么第二个不起作用?
提前致谢