如何删除c语言格式警告?

时间:2015-11-02 05:52:54

标签: c pointers

#include <stdio.h> 
int main(void) { 
  int *pVar, var = 10;
  pVar = &var;
  //*pVar = var; 

  printf("value = %d, address = Ox%X\n", var, &var);    
  // Format specifies type 'unsigned int' but the argument has type 'int *' 

  printf("pValue = %d, address = Ox%X\n", *pVar, pVar);
  // Format specifies type 'unsigned int' but the argument has type 'int *' 

  *pVar = 20; 

  printf("value = %d, address = Ox%X\n", var, &var);
  // Format specifies type 'unsigned int' but the argument has type 'int *' 

  printf("pValue = %d, address = Ox%X\n", *pVar, pVar);
  // Format specifies type 'unsigned int' but the argument has type 'int *' 

  return 0; 
} 

我发现了一些警告

格式指定类型unsigned int,但参数的类型为int *

  

即使程序按我的意图运行,我也想知道为什么会这样。

     

如果不在结果中出现错误,我该怎么做才能删除这些错误?

1 个答案:

答案 0 :(得分:5)

您可以使用- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath if ([selectedIndexArray containsObject:indexPath.row]) { // change image to check mark here... } else { // Change image to un-check mark } } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if ([selectedIndexArray containsObject:indexPath.row]) { [selectedIndexArray removeObject:indexPath.row]; } else { [selectedIndexArray addObject:indexPath.row]; } [tableView reloadData]; } 格式作为

中的指针
%p