Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and works. Contact: aviboots(AT)netvision.net.il
Liquid Web Managed Dedicated Server: RAID 1 SSD with 16GB of RAM minimum! 24/7 On-Site Heroic Support! Industry-Leading SLA!

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Liquid Web Cloud VPS Hosting

8,365 questions

11,625 answers

573 users

How initialize part of array with the same number in C

1 Answer

0 votes
#include <stdio.h>

int main(void) 
{
   int array[] = { [3 ... 8] = 98};
   
   for (int i = 0; i < 9; i++)
   { 
        printf("array[%d] = %d\n", i, array[i]);
   }
  
   return 0;
}
    
/*
run:
 
array[0] = 0
array[1] = 0
array[2] = 0
array[3] = 98
array[4] = 98
array[5] = 98
array[6] = 98
array[7] = 98
array[8] = 98

*/

 




answered Aug 27, 2017 by avibootz
...