C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, so it has found lasting use in applications that had formerly been coded in assembly language, including operating systems as well as various application software for computers ranging from supercomputers to embedded systems. It is distinct from C++ (which has its roots in C) and C#, and many later languages have borrowed directly or indirectly from C.

Share tech news, updates, or what's on your mind.

Sign up to Post


I want to put a project I am writing on GitHub for public viewiewing.
What I want to make sure is no private information is in there.
I know my code does not have any references in there.

So things I am concerned about are.

My microsoft account email address
My azure devops Repos path - e.g. https://dev.azure.com/Code/Project/_git/xxxx etc
+ anything else I am not aware of.

I am assuming I would need to remove a git subdirectory somewhere.

Anything else - any other hidden files etc?

My original code is in Azure Devop's at the moment.
I am happy and prefer if I can not to have all the history there.

Which is why I was thinking of manually uploading it all.

Any thoughts / ideas.


Active Protection takes the fight to cryptojacking
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

I am using arduino-crypto for my ESP8266. I'm not running into any errors but I do have an issue that I hope you can solve for me.

This code:
#define BLOCK_SIZE 16

uint8_t key[BLOCK_SIZE] = { 0x1C,0x3E,0x4B,0xAF,0x13,0x4A,0x89,0xC3,0xF3,0x87,0x4F,0xBC,0xD7,0xF3, 0x31, 0x31 };
uint8_t iv[BLOCK_SIZE] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

char plain_text[] = "1234567890ABCDEF1234567890ABCDEF";

  // encrypt
  int length = 0;
  bufferSize(plain_text, length);
  char encrypted[length];
  encrypt(plain_text, encrypted, length);

  Serial.print("Encrypted: ");


Open in new window

Works just fine and gives me an encryption value of:

Encrypted: y3QzsGi6cYiy3GGs31jXvTY8VI2OrlxsohOasiw4pgP+54gWXtUZPrjuRvOfyRTz

Open in new window

Now if i do both encrypt and decrypt then it decodes it just fine.

However, when i just run the decryption and copy the encrypted value and then run this:

// decrypt
  char* encrypted = "y3QzsGi6cYiy3GGs31jXvTY8VI2OrlxsohOasiw4pgP+54gWXtUZPrjuRvOfyRTz";
  int length = strlen(encrypted);
  char decrypted[length];
  decrypt(encrypted, decrypted, length);
  Serial.print("Decrypted: ");

Open in new window

It outputs this in the console:

Decrypted: ⸮⸮⸮⸮⸮j⸮Ҏ⸮R|;⸮⸮1234567890ABCDEF

Open in new window

It has a few original message letters/numbers in there but not sure why its not decrpting it like it does when you run both back-to-back.

What can be done in order to fix this?
Hey all I am trying my best to fixed these few errors below. The C++ code is from an Arduino library that i wanted to convert to Visual C++ dll for use in one of my C# applications.

These are the areas that have the errors:

void AES::do_aes_encrypt(BYTE *plain,int size_p,BYTE *cipher,BYTE *key, int bits, BYTE ivl [N_BLOCK]){
  BYTE plain_p[get_size()];
  int blocks = get_size() / N_BLOCK;
  set_key(key, bits) ;
  cbc_encrypt(plain_p, cipher, blocks, ivl);

Open in new window

The "BYTE plain_p[get_size()];" has the error of "'this' cannot be used in a constant expression".

string AES::letsDecrypt(BYTE *key, string msg, AES aes) {
  char data_decoded[200];
  char iv_decoded[200];
  char temp[200];
  BYTE out[200];
  aes.set_key(key, sizeof(key));
  msg.toCharArray(temp, 200);
  int b64len = base64_decode(data_decoded, temp, msg.length());
  string(iv_Encoded).toCharArray(temp, 200);
  base64_decode(iv_decoded, temp, string(iv_Encoded).length());  
  aes.do_aes_decrypt((BYTE *)data_decoded, b64len, out, key, 128, (BYTE *)iv_decoded);
  char message[msg.length()];
  char* msgBase64 = (char *)out;
  base64_decode(message, (char *)out, msg.length());

  return std::string(message);

Open in new window

The "msg.toCharArray(temp, 200);" has the error of "class "std::basic_string<char, std::char_traits<char>, std::allocator<char>>" has no member "toCharArray"".

Another error on the same code above "char message[msg.length()];" has the error of "expression must have a constant value".

And lastly i get this error: "unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?" Which when i try to include it-it says it cant be found.

Help would be great!
In a code part of a software that I got to update I found a the line

TypeAndTimeZone = UINT16( 1 << 12 | uint16(timeDiff/60));

timeDiff has the negative value -7200.0000

TypeAndTimeZone will get the value: 65416
What kind of numeric value is this because I expected -120.
If I will do
TypeAndTimeZone = TypeAndTimeZone * -1 I will get 120 instead of 65416.

Is 65416 a negative numeric value? Or is there an error to get this as a negative value?
 // New temperature readings - 0 ~ 100C
    temp_value = analogRead(ANALOG_PIN_0);
    temp_value = (temp_value/4096) * 100;

    // New temperature readings - 0 ~ 300 PSI
    press_value = analogRead(ANALOG_PIN_1);
    press_value = (press_value/4096) * 300;
    void GET_METER() {     // Update read all data
       for (char i = 0; i < Total_of_Reg ; i++){
           DATA_METER [i] = Read_Meter_float(ID_meter, Reg_addr[i]);// ID_METER_ALL=X

Open in new window

//New EnergyData
   Data_meter[0] = 241.25        //voltage
   Data_meter[1] = 3.53            //Ampere
   Data_meter[2] = 49.1            //kw
   Data_meter[3] = 0.98           //pf
   Data_meter[4] = 49.99         //freq
   Data_meter[5] = 120.58      //kw

   temp_value = 55.3                //Celsius
   press_value = 300.1             //pressure in psi

I am looking forward to send data in jason format. Referring to my code: -

data_send = "{
                              "temp_value" : 55.3,              
                              "press_value": 300.1,
                              "Voltage" : 241.25,
                              "Ampere": 3.53,
                              "KW": 49.1,
                              "pf": 0.98,
                              "freq": 49.99,

How to convert data_send into string format.
I need to learn embedded software and hardware development life cycle and use it to create electronic hardware/software component.  I need to approach this job systematically.  For example, what is the order of tasks.  Probably requirements should be gathered and documented.  Then, what's next and so on?  At what stage should we select hardware components.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

#define N 4
#define NxN (N*N)
#define TRUE 1
#define FALSE 0

struct node {
	int tiles[N][N];
	int f, g, h;
	short zero_row, zero_column;	/* location (row and colum) of blank tile 0 */
	struct node *next;
	struct node *parent;			/* used to trace back the solution */

int goal_rows[NxN];
int goal_columns[NxN];
struct node *start,*goal;
struct node *open = NULL, *closed = NULL;
struct node *succ_nodes[4];
pthread_barrier_t barrier_before_filtering, barrier_after_filtering;
int finish=0, multithread=0;

void print_a_node(struct node *pnode) {
	int i,j;
	for (i=0;i<N;i++) {
		for (j=0;j<N;j++) 
			printf("%2d ", pnode->tiles[i][j]);

struct node *initialize(int argc, char **argv){
	int i,j,k,index, tile;
	struct node *pnode;

	pnode=(struct node *) malloc(sizeof(struct node));
	index = 1;
	for (j=0;j<N;j++)
		for (k=0;k<N;k++) {
			if(tile==0) {
	printf("initial state\n");

	pnode=(struct node *) malloc(sizeof(struct node));

	for(index=1; index<NxN; index++){

Open in new window

I have this bit of C Code for a project I working on for a project.  
logit("Username: %s Password: %s", authctxt->user, password);

Open in new window

This is going to be used in a proof of concept project and I want to obscure the real password.  I was thinking of either replacing the whole password with a set of characters or maybe keeping the first and last two characters and replacing the rest with a set of characters.  Maybe Xs.   Looking for suggested modification.
Hey all I am having the hardest time trying to figure out how to go about the order of decryption the encrypted text.

This is my sketch code:

#include "AES.h"
#include "base64.h"

AES aes;

void gen_iv(byte  *iv) {
    for (int i = 0 ; i < N_BLOCK ; i++ ) {
        iv[i]= (byte) *(volatile uint8_t *)0x3FF20E44;

void setup() {

    char b64data[2000];
    byte cipher[1000];
    byte iv [N_BLOCK];
    char *encodedFinal;

    Serial.println("Let's encrypt:");

    byte *key = (unsigned char*)"5TGB&YHN7UJM(IK<";
    byte *my_iv = (unsigned char*)"!QAZ2WSX#EDC4RFV";
    char *msg = "{\"data\":{\"value\":300}, \"SEQN\":700 , \"msg\":\"IT WORKS!!\" }";

    //Set the key for AES
    aes.set_key(key, sizeof(key));

    Encoding section

    //Encode IV to Base64
    base64_encode(b64data, (char *)my_iv, N_BLOCK);    
    Serial.println("      IV -> Base64: " + String(b64data));
    Serial.println("       Orignal Msg: " + String(msg));

    //Encode message into Base64
    int b64len = base64_encode(b64data, (char *)msg, String(msg).length());
    Serial.println(" Message -> Base64: " + String(b64data));

    // Encrypt into AES256   
    aes.do_aes_encrypt((byte *)b64data, b64len , cipher, key, 256, my_iv);
    Serial.println("Encrypted: " + 

Open in new window

In reality, the "open file table" is not really a table, but let's say we will see it as a table. Which columns does this table have?

For example, see: https://cseweb.ucsd.edu/classes/sp16/cse120-a/applications/ln/lecture15.html

The open file table contains several pieces of information about each file:

the current offset (the next position to be accessed in the file)
a reference count (we'll explain below in the section about fork())
the file mode (permissions),
the flags passed into the open() (read-only, write-only, create, &c),
a pointer to an in-RAM version of the inode (a slightly light-weight version of the inode for each open file is kept in RAM -- others are on disk), and a structure that contains pointers to all of the .
A pointer to the structure containing pointers to the functions that implement the behaviors like read(), write(), close(), lseek(), &c on the file system that contains this file. This is the same structure we looked at last week when we discussed the file system interface to I/O devices.

So according to this, I would say:

- offset
- reference count
- file mode (permission)
- the flags passed into the open() (read-only, write-only, create, &c),
- pointer to in-RAM inode
- pointer to "read(), write(), close(), lseek(), &c".

But the file descriptor also points to the open file table, so we need another column that connects the "file descriptor table" with the "open file table". So I would add a column like:
Big Business Goals? Which KPIs Will Help You
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

I'm trying to investigate a problem with resource files generated by Google Omaha. These resource files contain a place-holder token (%1!s!), which is substituted with branding details during the build process. There are numerous language resource files that contains string tables and this

Here is an example string: "%1!s! some arbitrary text"

Where %1!s! is a place-holder for some substitution text?

My question: is this place-holder substitution mechanism a standard part of the Windows resource file mechanism? If so, can someone please either explain how it works? Where does it get the text used to substitute the place holder? I'm assuming the place-holder works similar to place-holders in printf? If so, how does it know which text token to replace this with? If this is not a standard resource file mechanism, does anyone have a clue as to how Omaha does this during the build process?

Many thanks.

Note: I'm not looking for suggestions to use a different approach. This is how Omaha does it and I just need to understand how this works. Thank you.
I am writing a Linux PAM module.
from pam_sm_authenticate I am calling a function to get the user password,

static int login_converse(pam_handle_t *pamh, int msg_style, char *message, char **password)
	CONST struct pam_conv *conv;
	struct pam_message resp_msg;
	CONST struct pam_message *msg[1];
	struct pam_response *resp = NULL;
	int retval;

	resp_msg.msg_style = msg_style;
	resp_msg.msg = message;
	msg[0] = &resp_msg;

	/* grab the password */
	retval = pam_get_item(pamh, PAM_CONV, (CONST void **) &conv);
	retval = conv->conv(1, msg, &resp,conv->appdata_ptr);
	if (password) {
		*password = resp->resp;
	return PAM_SUCCESS;

Open in new window

The string length of resp->resp I get is equal to the password length entered in the UI, but the value of resp->resp is always the same,
0x080a0d7f 494e434f etc...

What am I doing wrong, and how do I pull the clear text password out?
Redirecting output ([n]>[|]word), when does "n" greater than 2 make sense?

This question is about redirecting output in bash, see: https://www.gnu.org/software/bash/manual/html_node/Redirections.html#Redirecting-Output

The general format for redirecting output is:


I already understand the basics (you're just redirecting a file descriptor to a file for writing). But, can someone give me an example when it does make sense to use for example: 3>. In other words, if n is greater than stdin, stdout, stderr (>2), for what would you need it?

I can do:

echo 'test' 3> test-file.txt

Open in new window

This will not write anything to "test-file.txt". This is logical, because now there is just a file descriptor with number 3 pointing to test-file.txt for writing, but there is no input to fd=3 so there is also nothing to write.

The only way to give it some input is to connect file descriptor 3 for reading with a file (or connect it to the output of a pipe). But if you would do that, then fd 3 doesn't point to test-file.txt anymore. So then in the end, fd 3 was connected to test-file.txt without any reason.

So in what kind of situation it's useful to use >n with n greater than 2?
Binary bomb phase 3
I am having trouble understanding this part of my bomb lab. I am not sure where to go from here. I know that I need to figure out what two decimals values will make the program not explode. I have attached the assembly code for reference.
   0x0000000000400ffd <+0>:     sub    $0x18,%rsp
   0x0000000000401001 <+4>:     mov    %fs:0x28,%rax
   0x000000000040100a <+13>:    mov    %rax,0x8(%rsp)
   0x000000000040100f <+18>:    xor    %eax,%eax
   0x0000000000401011 <+20>:    lea    0x4(%rsp),%rcx
   0x0000000000401016 <+25>:    mov    %rsp,%rdx
   0x0000000000401019 <+28>:    mov    $0x402b5b,%esi
   0x000000000040101e <+33>:    callq 0x400c90 <__isoc99_sscanf@plt>
   0x0000000000401023 <+38>:    cmp    $0x1,%eax
   0x0000000000401026 <+41>:    jg     0x40102d <phase_3+48>
   0x0000000000401028 <+43>:    callq 0x4017e4 <explode_bomb>
   0x000000000040102d <+48>:    cmpl   $0x7,(%rsp)
   0x0000000000401031 <+52>:    ja     0x4010ca <phase_3+205>
   0x0000000000401037 <+58>:    mov    (%rsp),%eax
   0x000000000040103a <+61>:    jmpq   *0x402840(,%rax,8)
   0x0000000000401041 <+68>:    cmpl   $0x68,0x4(%rsp)
   0x0000000000401046 <+73>:    je     0x4010cf <phase_3+210>
   0x000000000040104c <+79>:    callq 0x4017e4 <explode_bomb>
   0x0000000000401051 <+84>:    jmp    0x4010cf <phase_3+210>
   0x0000000000401053 <+86>:    cmpl   $0x126,0x4(%rsp)
   0x000000000040105b <+94>:    je     0x4010cf <phase_3+210>
   0x000000000040105d <+96>:    callq 0x4017e4 

Open in new window

By default, the first three rows of a "file descriptor table" consists of:

FD 0 (standard input,  associated with keyboard)
FD 1 (standard output, associated with screen)
FD 2 (standard error,  associated with screen)

Open in new window

These file descriptors point to one or more rows in the "open file table". Imagine we only have these three file descriptors. Then how does the "open file table" look like?

Usually all three file descriptors point to the same file, but that doesn't mean they point to the same entry in the "open file table". So how the open file table looks like?

_ | offset | reference count | permissions | flags | pointers
_ |    ?   |        ?        |      ?      |   ?
possible more rows

Open in new window

The lsof command shows for example:

lsof        721    root    0u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    1u      CHR              136,1       0t0          4 /dev/pts/1
lsof        721    root    2u      CHR              136,1       0t0          4 /dev/pts/1

Open in new window

The file "/dev/pts/1" is CHR (character special file). They all point to the same file.
I'm also wondering why it's for example "0u" and not "0r"? The file descriptor 0 stands for input, so it only has to read something.

r for read access;
w for write access;
u for read and write access;

Open in new window

I would expect something like: 0r, 1w, 2w instead of 0u, 1u, 2u? And what are the offsets et cetera?
Hi Experts,

I need your help as I'm new to programming.  Could you please help me out with a solution for the below program?

The program simulates different errors that the protocol checks for.

           Modify the program so that it implements "time out".


          Sender: sends a frame and calls a SIGALRM function and sets the timer

           for say 2 seconds. If the sender gets a response within two seconds

           from the receiver (either "ACK" or "NAK"), turn off the alarm and

           transmit the next frame. If no response is received, time out function

           kicks in and retransmits the frame.

           Receiver: When it sees an error in transmission, do not send back

           anything to the sender and this causes the time out and retransmit.

Link to the problem:

The code works fine on my own system, but while submitting shows wrong answer?

   #include <stdio.h>
    void main()
    	int t, n, count;
    	scanf("%d", &t);
    	printf("\n%d", count);

Open in new window

I had this question after viewing Using AT commands with C.

I'm doing a project and want to connect my gsm "click" to my phone USING C PROGRAMMING, have it wired up ok just the program is letting me down..... [ I want the gsm to send a message to my phone ]
The GSM is connected to the UART serial port of my 8051f020 microcontroller, any help much appreciated my program is as follows:

 void send_it (void) interrupt 4 using 1   // This is the ISR 
		TI0 = 1; // TI must be cleared by software when writing directly  
	                       // to SBuf  as shown in the previous program – However,   
                   // the  Printf function requires TI to equal “1” on entering
		          // the function.
		printf ("Hello \n\n");  
   		printf ("This text was sent to the Uart using Printf \n\n"); 
    printf("AT+CMGF=1<CR>%c\n\n"); // configured the GSM module to SMS mode                                     

    ("AT+CMGS=\"08******\"HELLO"); // send mobile number to the GSM           

Open in new window

I am in need of an Excel macro that will perform the following:

Compare two columns of stock symbols that are numerically listed and the results of the comparison displayed in a third column.  I’m looking for stocks in column B that have improved in their numerical order (one being the best) from their listing in column A.  The results would be displayed in new column C, and the entries would be listed in order of those making the best improvement at the top.

•      Columns A and B contain 200 entries (rows) each.  No blank cells in either column A or B.
•      Column B may have symbols that are not contained in column A.  
•      Symbols in column B not listed in column A would receive the highest ratings in column C.
•      If there are two or more symbols in column B that are not in column A, the symbols in column B would be ranked accordingly in column C.

Example of conditions for column C listing using attached example file: Two columns of Symbols.xlsx.
•      Symbol ARDM is listed in column B but not column A, so it goes to the top of the list in column C and is listed alphabetically (preferred, but not necessary).
•      Symbol FCRE also listed in column B but not column A, so it goes to the top of the list in column C and is listed alphabetically (preferred, but not necessary).
•      ATNM was 151 in column A, and is 8 in column B, a gain of 143, so it would go above CADC, which was 91 in column A and is 10 in column B for a gain of 81.
•      CADC would go above NEPT …
Why Diversity in Tech Matters
LVL 12
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Hello sir,
I am creating windows application using C# 2010 - Here i am using 3 forms
in my first form place a one data grid view and enter 6 rows but i am enter below format (it's stored at 2 empty rows)
EX :
Sl.No      Name       Age
1      A      10
2      B      11
5      C      12
6      D      13

Like this format - it's successfully stored at sql db.
IN my second form i am using approximately 10text boxes and enter 10 text boxes vales stored at sql db.
placed 2 drop down list and below one data grid view, here i am select  1st drop down(it's binding a first form db) records are display my 3rd form data grid view same as to form1 like below example,
but here i want
I am select a 2nd drop down binding a records 2nd form db. in my empty space cells how to display seconds form text box values as an row 3rd,& 4th rows.
Sl.No      Name       Age
1      A      10
2      B      11
5      C      12
6      D      13

any one give me suggestions.
Actually I have given a task to create an ini prase and Reding writing updating all these thing in c can you please help me something I have already attach an attachment  pls reply fast
The code snippet below is part of the restaurant menu program you previously used in the lab. Add a choice for a drink. Add the necessary code to allow the program to calculate the total price of order for the user. Assume the following price list:

Hamburger $5
Hotdog $4
Fries $3
Drink $2

The program should allow the user to keep entering order until choosing to exit. At the end the program prints an order summary similar to this:

You ordered 2 hamburger(s), 1 hotdog(s), 3 fries, 0 drink(s).

Price: $23
HST:  $2.99
Total: $25.99

Code snippet
do {

printf("What do you want to eat today?\n");
printf("1. Hamburger\n");
printf("2. Hotdog\n");
printf("3. Fries\n");
printf("4. Exit\n");
printf("Enter your choice: ");
scanf("%d", &choice);

switch(choice) {
case 1:
printf("You ordered a hamburger\n");
case 2:
printf("You ordered a hotdog\n");
case 3:
printf("You ordered fries\n");
case 4:
printf("Order finished, thank you!\n");
printf("Wrong choice! try again: ");

} while (choice != 4)

Open in new window

needhelp in these ASAP
I am stucked in a project, where I have to convert some audio:
The Audio is PCM 16bit big endian 16Khz stereo & Ulaw 8bit 8000hz. Have to be able to go both ways.
Do you have any recommended Libs or even better software examples that will help me doing it :)

I get the audio in the PCM format as Callback data.
static int stream_GSMdata_2_ulaw(int16 id, char* data, uint32 size)
And after the conversion to Ulaw I need to send the RTP packets in 60 ms chunks (480bytes) via UDP:

Any help is appreciated :)
Need several WIX form drop-down boxes to have the data filtered on the previous drop-down results.  I found an example of utilizing a states.jw (??) import tool for states of the United States that is evidently 'built in' to WIX, however, my data is in another WIX database / dataset collection.    So, to be clear, the available drop down choices for drop box B is dependent (filtered) based on the results of drop-down A; the available drop down choices for drop box C is dependent (filtered) based on the results of drop-down B.  there are only these three dependent drop-downs at the moment.

Any step-by-step instructions would be absolutely fantastic!!  <<thanks in advance>>
I am working on creating an android app that scans the deleted data which is not overwritten by android device and recovers it, just like data recovery tool. How to create a recovery tool inside an android app is there a tutorial or any thing?






C is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, so it has found lasting use in applications that had formerly been coded in assembly language, including operating systems as well as various application software for computers ranging from supercomputers to embedded systems. It is distinct from C++ (which has its roots in C) and C#, and many later languages have borrowed directly or indirectly from C.

Top Experts In