Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //-std=c99 -Wall -Wextra -Wpedantic -Wshadow
- #include <stdio.h>
- #include <stdlib.h>
- #include <stdint.h>
- #include <stdbool.h>
- #define DARRSIZE 10
- bool testas(double* arr, uint32_t num)
- {
- double dV = 0.0;
- for(uint32_t i = 0; i < 10; ++i)
- {
- if(num<=i) return false;
- *(arr+i) = dV;
- dV += 1.0;
- }
- return true;
- }
- int main (int argc, char **argv){
- double dArr[DARRSIZE]={0.0};
- if(!testas(dArr,DARRSIZE))
- {
- printf("error!\n");
- return 1;
- }
- for(uint32_t i =0; i < DARRSIZE; ++i)
- {
- //*(dArr+1) dArr[i]
- printf("%f ",dArr[i]);
- }
- printf("\n");
- return 0;
- }
- /*
- output:
- 0.000000 1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 7.000000 8.000000 9.000000
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement