hello

i have the following

char *b2b_data_Out[1]={"0"};

The number "0" can change. I have a loop which goes round, and i have an integer value which i am going to use to change the above "0" into whatever value i need

Question - How do i assign my integer value to the above variable?

My first question is why are you using an array of 1? There's no benefit to using an array if it only has one element.

>How do i assign my integer value to the above variable?
Presumably you're asking how do you convert an integer into a string. Here's an example that should fit into your code, but I'm making a few assumptions because your array is somewhat silly. Rather, I simply changed it to an array of char that can hold the string representation of an integer:

#include <stdio.h>

#define INT_DIGIT 21 /* Supports 64-bit int */

int main ( void )
{
  char b2b_data_Out[INT_DIGIT];
  int x;

  printf ( "Enter a value: " );
  fflush ( stdout );

  if ( scanf ( "%d", &x ) == 1 ) {
    sprintf ( b2b_data_Out, "%d", x );
    puts ( b2b_data_Out );
  }

  return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.