Pointer parameter pointed-to type mismatch

A format specifier requires a pointer as the corresponding argument.

This diagnostic is emitted for the special case of %s and %n format specifiers in a printf-type call. In this case, the argument corresponding to the %s must be a pointer to a null-terminated string of characters and the argument corresponding to the %n must be a pointer to int.

ID

Observation

Description

1

Call site

The actual argument that was passed

Example

          
#include <stdio.h> 

int main(int argc, char **argv)
{
    int n = 1;
    
    // bad: should be printf("%d %n", *argv, argc, &n);
    printf("%s %d %n", argc, argc, n);
    
    return n;
}
        

Copyright © 2010, Intel Corporation. All rights reserved.