随口问问而已,可以来看看

c语言里面
int n,m;

int n;
int m;
话费的时间一样不

几乎一样的

img

#include <iostream>
#include <vector>
#include<ctime>
using namespace std;

int main()
{
    clock_t startTime, endTime;
    int runtimes = 10000000000;
    startTime = clock();//计时开始
    for (int i = 0; i < runtimes; ++i)
    {
        int a, b;
    }
    endTime = clock();//计时结束
    cout << "一起申明变量,运行" << runtimes << "次的时间为: " << (double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl;

    startTime = clock();//计时开始
    for (int i = 0; i < runtimes; ++i)
    {
        int x;
        int y;
    }
    endTime = clock();//计时结束
    cout << "分开申明变量,运行" << runtimes << "次的时间为: " << (double)(endTime - startTime) / CLOCKS_PER_SEC << "s" << endl;

    system("pause");
    return 0;
}

编译后应该是一样的