Skip to content

Instantly share code, notes, and snippets.

@alphaville
Created January 27, 2013 17:32
Show Gist options
  • Select an option

  • Save alphaville/4649329 to your computer and use it in GitHub Desktop.

Select an option

Save alphaville/4649329 to your computer and use it in GitHub Desktop.
float[][] as float*
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
int main(int argc, char** argv) {
float A[4][4] ={
{1.0f, 2.0f, 3.0f, 4.0f},
{4.0f, 5.0f, 6.0f, 7.0f},
{8.0f, 9.0f, 10.0f, 11.0f},
{12.0f, 13.0f, 14.0f, 15.0f}
};
float* vA = &A[0][0];
ptrdiff_t i;
for (i = 0; i < 16; i++) printf("vA[%td]=%f\n", i, vA[i]);
return (EXIT_SUCCESS);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment