小编cal*_*ser的帖子

为什么在VisualStudio 2010中未达到断点?

    static void Main(string[] args)
    {
        List<int> li = new List<int>() { 1, 20, 30, 4, 5 };
        GetNosLessThan5(li);
    }

    public static IEnumerable<int> GetNosLessThan5(List<int> numbers)
    {
        foreach (var v in numbers)
        {
            if (v < 5)
                yield return v;
        }
    }
Run Code Online (Sandbox Code Playgroud)

我在void main的开头放了一个调试点.当我连续按f11时,黄色箭头仅覆盖主功能块,调试终止.它根本没有达到"getnoslessthan5"的功能.融合.!

c# visual-studio-2010 visual-studio-debugging

2
推荐指数
1
解决办法
107
查看次数

什么是C中"字符数组"的指针?

int check_authentication(char *password) 
  // 1
{
int auth_flag = 0;
char password_buffer[16];

strcpy(password_buffer, password);      // 2
   if(strcmp(password_buffer, "brillig") == 0)
   auth_flag = 1;
   if(strcmp(password_buffer, "outgrabe") == 0)
   auth_flag = 1;
   return auth_flag;
}

check_authentication(argv[1]) // Passing a 'Command Line argument'
// ( which is a string in this example) to the check_authentication function.
Run Code Online (Sandbox Code Playgroud)

我有两个问题.上面标有1和2的行,

  1. 该函数需要一个字符指针作为参数.但是我们传递一个"字符串"i,一个字符数组作为参数.怎么样 ?????

  2. 指针"password"(指向一个字符)所保存的地址被复制到"password_buffer"数组中.对我来说完全是无稽之谈 .请解释一下.

c c++ arrays command-line pointers

1
推荐指数
1
解决办法
155
查看次数