c - how to call a function having pointers as arguments -


i trying call function

int db5_disk_header(struct db5_raw_internal *rip, const unsigned. char *cp) {    fprintf(openfile, "these headers %d b %d c %d", rip->a, rip->b, rip->c);    ... } 

how call function in main() in c?

read basic pointer operations

in case:

#include <stdio.h>  struct db5_raw_internal {     int a, b, c; };  int db5_disk_header(struct db5_raw_internal *rip) {     fprintf(stdout, "these headers %d b %d c %d", rip->a, rip->b, rip->c);     return 0; }  int main(void) {     struct db5_raw_internal x = {1, 2, 3};     db5_disk_header(&x); // pointer x using address-of operator (&)      struct db5_raw_internal *y = &x;     db5_disk_header(y); // y pointer (don't use &)      return 0; } 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -