1

pthread_mutex_t qlock[5] = PTHREAD_MUTEX_INITIALIZER;

pthread_cond_t qcond[5] = PTHREAD_COND_INITIALIZER;

It is giving me error as follows...

error: array must be initialized with a brace-enclosed initializer

.. Please, can somebody debug this or tell me a way to solve it...

jruizaranguren
  • 12,679
  • 7
  • 55
  • 73
Invictus
  • 2,653
  • 8
  • 31
  • 50
  • You have asked 14 questions and accepted no answers! It's impossible you did not get a single decent answer to all these questions - please go over your questions and acknowledge the time and effort other people have put in answering them! – Branko Dimitrijevic Oct 01 '11 at 17:41
  • how do I accept the answers???.. I am new to this group.. – Invictus Oct 01 '11 at 18:30
  • @Invictus See the [faq](http://stackoverflow.com/faq#howtoask) but the short version is click on the check box next to the answer that best answers your question. – Ze Blob Oct 01 '11 at 18:57

2 Answers2

3

This initializes a mutex:

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

This initializes an array:

int array[5] = { 0, 1, 2, 3,  4 };

...that should be enough to get you going.

K-ballo
  • 80,396
  • 20
  • 159
  • 169
1

I'd suggest you reading a beginner book on C programming language. See for example a related SO question.

BTW, at this level of C knowledge I would highly recommend you to stay away from multithreaded programming (at least with pthreads).

Community
  • 1
  • 1
Ilia K.
  • 4,822
  • 2
  • 22
  • 19