language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <types.h>
#include <lib.h>
#include <synchprobs.h>
#include <synch.h>
/*
* This simple default synchronization mechanism allows only creature at a time to
* eat. The globalCatMouseSem is used as a a lock. We use a semaphore
* rather than a lock so that this code will work even before locks are implemen... |
C | #include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <stdbool.h>
#define BACKGROUND 39
#define BACKGROUNDRED 36
#define RED 4
#define WHITE 7
typedef enum months
{JANUARY = 0, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER};
char *rus (char *p)
{
static ch... |
C | /*
vector的删除和添加操作
*/
void moveZeroes(vector<int>& nums) {
if (nums.size() == 0)
{
return;
}
int i = 0;
int count=0;
while (true)
{
if (count == nums.size())
{
return;
}
if (nums[i] == 0)
{
nums.erase(nums.begin() + i);
nums.push_back(0);
i--;
}
i++;
count++;
}
} |
C | // compile with -std=c99
// reused code from 1-17 because i didn't feel like rewriting getline
// ignore the whitespace, it's there so you can simply "./a.out < kushblazingjudah.c"
#include <stdio.h>
#define MAXLINE 1000
int getline(char line[], int maxline);
int main() {
int len;
char line[MAXLINE];
while ((len... |
C | #include<stdio.h>
int main() {
float x1 = 23.4000;
float x2 = 43.2300;
float x3 = 32.2200;
float x4 = 68.2100;
float x5 = 9.8000;
float *ptr1 = &x1;
float *ptr2 = &x2;
float *ptr3 = &x3;
float *ptr4 = &x4;
float *ptr5 = &x5;
float* arr1[5]... |
C | #include <stdio.h>
inline int read ()
{
char c;
int n = 0;
while ((c = getchar_unlocked ()) < 48);
n += (c - '0');
while ((c = getchar_unlocked ()) >= 48)
n = n * 10 + (c - '0');
return n;
}
int main (void)
{
int t = read ();
while (t--)
{
int n = read (), i, count[8];
for (i = 0; i < 8; i++)
... |
C | #include<stdio.h>
#include<ctype.h>
#include<string.h>
main()
{
int ncase,i,j,len;
float point,prob;
char temp[200];
//freopen("in.txt","r",stdin);
scanf("%d\n",&ncase);
while(ncase--)
{
scanf("\n");
gets(temp);
len=strlen(temp);
point=0;
for(i=0; i<... |
C | #include <stdio.h>
#include <math.h>
int main(){
float a,b,c,d;
printf("enter the values of a,b,c for eqn a*x*x+b*x+c=0:");
scanf("%f %f %f",&a,&b,&c);
d=(b*b)-(4*a*c);
printf("\n value of d is %f",d);
if(d>0)
printf("\nroots of eqn are %f %f",(-b+sqrt(d))/(2*a),(-b-sqrt(d))/(2*a));
else if(d=0)
p... |
C | //Write a program to find the volume of a tromboloid using one function
#include<stdio.h>
Void main()
{
Int h,b,d,vol;
Printf(" enter hight,breadth,deapth of tromboloid");
Scanf("%d%d%d,&h,&b,&d);
Vol = *(h*d*b) + (d/b))/3;
Printf(%d*%d*%d+%d/%d)/3 = %d h,d,b,d,b,vol);
}
|
C | /*******************************************************************************
eex_timer.h - Real time executive Timer.
COPYRIGHT NOTICE: (c) ee-quipment.com
All Rights Reserved
******************************************************************************/
#ifndef _eex_timer_H_
#define _eex_timer_H... |
C | // CITS2002 Project 2 2020
// Name(s): Harry Carpenter, My Inner Conscience
// Student number(s): 22723303, ---
#include "mergetars.h"
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <stdbool.h>
#include "sysbin.h"
// I suppose we're assuming that the user IS passing through valid... |
C | #include <stdio.h>
int main () {
int sum = 0;
int start = 1;
int end = 10000;
int max = 555;
for( int i = start; i < end; i++)
{
sum = sum + i;
if (sum > max)
{
printf("with max. sum %d, the sum from %d to %d is equal to %d", max, start, i, sum );
break;
}
}
//printf("The sum from %d to %... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
static char* addBinary(char* a, char* b)
{
int len1 = strlen(a);
int len2 = strlen(b);
int len = len1 > len2 ? len1 + 1 : len2 + 1;
char *result = malloc(len + 1);
result[len] = '\0';
result[len - 1] = '\0';
int i, j, carry = 0;
... |
C | extern void outc( char c );
void
main() {
for (char* p = "Hello world!\n"; *p;)
outc( *p++ );
} |
C | #include "PyGuiBindings.h"
#include "DataTypes.h"
#include "MidiDefinitions.h"
#include "USB.h"
#include "Target_Emulator.h"
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
typedef struct _midiMap{
int pin;
int command;
int channel;
int value;
} midiMap;
void Sleep_ms(unsigned int milliSeconds)
{... |
C | #include<stdio.h>
int main()
{
int n;
printf("Please input an integer");
scanf("%d",&n);
printf("The result is:\n");
for(int i=1;i<=n;i++) //ӡϰ벿Ǻ
{
for(int j=1;j<=n-i;j++)
printf(" ");
for(int j=1;j<=2*i-1;j++)
printf("*");
printf("\n");
}
for(int i=n-1;i>=1;i--) //ӡ°벿Ǻ
{
for(int j=1;j<=n-i;... |
C | /*
** EPITECH PROJECT, 2019
** my_compute_factorial_it
** File description:
** factorial with iterative loop
*/
int my_compute_factorial_it(int nb)
{
int factorial = nb;
if (nb < 0)
return (0);
if (nb == 0)
return (1);
if (nb > 12)
return (0);
while (nb > 1) {
facto... |
C | /*
输入一个整数,连续显示出该整数个 *(for)
*/
#include <stdio.h>
int main(void){
int a;
printf("请输入一个整数:");scanf("%d",&a);
for(int i=1;i<=a;i++){
printf("*");
}
printf("\n");
} |
C | /*
* mipscodegen.c - Functions to translate to Assem-instructions for
* the Jouette assembly language using Maximal Munch.
*/
#include <stdio.h>
#include <stdlib.h> /* for atoi */
#include <string.h> /* for strcpy */
#include "util.h"
#include "symbol.h"
#include "absyn.h"
#include "temp.h"
#include "tr... |
C | //michael silianov + evgeney golovachov
#include <stdio.h>
#include <stdlib.h>
#define N 5
// find and print beginning of siquences
// of same numbers 'size' length
void func(int mat[N][N], int size);
void main() {
int mat[N][N] = {
{1,2,3,4,5},
{2,1,1,1,1},
{2,1,5,6,7},
{2,1,6,7,... |
C | #include<stdio.h>
int main()
{
int n,a[n],i,x;
printf("n");
scanf("%d",&n);
printf("array");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
x=n/2;
if(n%2==0)
{
for(i=x;i<n;i++)
{
printf("%d",a[i]);
}
for(i=0;i<x;i++)
{
printf("%d",a[i]);
}
}
else
{
for(i=x+1;i<n;i++)
{
printf("%d",a[i]... |
C | #include <stdio.h>
int main(int __attribute__((unused)) argc, char __attribute__((unused)) *argv[])
{
int ascii;
float temp;
printf("Enter an ASCII codeint: ");
scanf("%d", &ascii);
printf("%d is the ASCII code for %c.\n", ascii, ascii);
printf("Enter an float value: ");
scanf("%f", &temp... |
C | #include <stdio.h>
void callback1(void) __attribute__((noinline));
void callback2(void) __attribute__((noinline));
void functionPtrInt_test(void (*callback_ptr)()) __attribute__((noinline));
void callback1(void) { ; }
void callback2(void) { ; }
void functionPtrVoid_test(void (*callback_ptr)())
{
(*callback_ptr) ... |
C | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE563_Unused_Variable__unused_value_int_22b.c
Label Definition File: CWE563_Unused_Variable__unused_value.label.xml
Template File: sources-sinks-22b.tmpl.c
*/
/*
* @description
* CWE: 563 Unused Variable
* BadSource: Initialize data
* GoodSource: Initialize a... |
C | #define NULL ((void*)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t; typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1
/* Forward d... |
C | #include <stdio.h>
#include <math.h>
#include <time.h>
#include </usr/include/gsl/gsl_math.h>
#include </usr/include/gsl/gsl_linalg.h>
const double x0 = 2.0;
const double sigma = 4.0;
double g(double x)
{
double a0=-pow(x0,2)/(2*pow(sigma,2));
double a1=x0/(pow(sigma,2));
double a2=-1/(2*pow(sigma,2))... |
C | /**
* Realtime logging
* Multiple threads
*
* For greater applications you should use a mutex for curses operations
*/
#include <stdio.h>
#include <ncurses.h>
#include <pthread.h>
#include <unistd.h>
#include <string.h>
static WINDOW *logWin, *cmdWin;
static int running;
static pthread_t thread;
static void *lo... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main() {
int fd0[2], fd1[2];
pid_t pid;
char buf[255];
pipe(fd0);
pipe(fd1);
pid = fork();
if(pid == 0){
read(fd0[0],buf,255);
printf("This is child process 1.\n");
write(fd1[1],"hello",sizeof("hello"))... |
C | #include "common.h"
void init_config(void)
{
//configure PORTB as output
TRISB = 0x00;
//configure PORTB as digital port
ADCON1 = 0x00;
//configure LATB with 0x55
LATB = 0x55;
//initially turn off all LED's
PORTB = 0x00;
}
unsigned short i;
void main(void)
{
init_config();
while(1)
{
//turn on all LED's
... |
C | /*#include <stdio.h>
int main()
{
/*
Q1.ü ũ ˴ϴ. 32Ʈ ü ũ ΰ?
1. 2Ʈ 2.4Ʈ 3. 8Ʈ 4. 16Ʈ
---------------------------------------------
4Ʈ
*/
/*
Q2.int data 0x12345678 Ǿ ֽϴ. data
ʰ short * Ͽ data 0x12340412 ϴ ڵ带 ۼϼ.
hint:Ʋ ý ϹǷ short * ù ° ϸ 0x5678 0x0412 ִ.
-----------------------------... |
C | /*
********************************************************************************************************
ļbsp_GPIO.c
ܣҪͨIO
עðеIOã
*********************************************************************************************************
*/
#include "bsp_GPIO.h"
/*
******************************************... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct jose{
int id;
struct jose *next;
}loop;
int count = 0,N=0,M=0;
/**
* @brief create a node of a linked list
*
* @param pro orignal address
* @param id people's id
*
* @return address of the newly built
*/
loop * create(loop *pro,int id)
{
loop *p = mal... |
C | // 3. Program to calculate sum of an array
#include <stdio.h>
int main()
{
int sum=0,i;
int a[]={1,2,3,4,5};
int n=sizeof(a)/sizeof(a[0]);
for(i=0;i<n;i++)
{
sum+=a[i];
}
printf("%d\n",sum);
}
|
C | // Copyright (c) Lawrence Livermore National Security, LLC and other VisIt
// Project developers. See the top-level LICENSE file for dates and other
// details. No copyright assignment is required to contribute to VisIt.
#include <RemoteProcess.h>
#include <BadHostException.h>
#include <TestUtil.h>
#define VERBOSE
... |
C | /*
* invert.c - calculate the inverse of a large integer in an integer multiplation group
*
* 2016-11-01 Steven Wart created this file
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <errno.h>
#include <stdarg.h>
#include <gmp.h>
void print_usage(char *name) {
printf("This program will... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct {
float x, y, z;
} vetor;
void sum(const vetor *v1, const vetor *v2, vetor *r) {
r->x = v1->x + v2->x, r->y = v1->y + v2->y, r->z = v1->z + v2->z;
}
float produto(const vetor *v1, const vetor *v2) {
return ((v1->x * v2->x) + (v1->y * v2->y) + (v1->z *... |
C | /* Example code for how to call the routine "dspeig" for the dense
* symmetric eigenproblem with matrix A in packed storage.
* The routine uses LAPACK routines for the reduction and
* back-transformation and must therefore be linked to LAPACK.
* The number of threads for the LAPACK routines are set by
* OMP_NUM... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define htlf 13
#define ecell "EMPTY_CELL"
typedef struct node
{
char key[50];
int pos;
}*HASH;
int c=0;
int close_hashfnc(char str[])
{
int i=0;
int sum=0;
while(str[i]!='\0')
{
sum+=(int)str[i];
i++;
}
return (sum%... |
C | #include "ft_printf.h"
int ft_find_specifier(const char *format)
{
int i;
i = 0;
if (format[i] == '%' && format[i + 1] != '%')
return (1);
return (0);
}
int exeption(char const *format)
{
int i;
i = 0;
if ((format[i] == '%' && format[i + 1] == '%')
return (1);
else
return (0);
}
void ft_process_spec... |
C | /*
* Author: Vinicius Ferraco Arruda
* Email: viniciusferracoarruda@gmail.com
* Professor: Eduardo Zambon
* Subject: Compilers
* Assignment: Implementation of an interpreter for the language C-Minus
*
*/
#ifndef ERROR_H
#define ERROR_H
#include <stdio.h>
#include <stdlib.h>
/* If this error occurs, let me kn... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
void* ThreadEntry1(void* arg){
(void)arg;
printf("Thread1\n");
return (void*)1;
}
void* ThreadEntry2(void* arg){
(void)arg;
printf("Thread2\n");
pthread_exit((void*)2);
return NULL;
}
void* ThreadEntry3(void* ... |
C | //C Program to Find Solution of Ordinary Differential Equation of 1st Order by Euler's Modified Method
#include <stdio.h>
#include <math.h>
#define f(x,y) (x+y)
double error(int a)
{
return 5*pow(10,-a-1);
}
double mod(double x)
{
if(x<0)
return -x;
else
return x;
}
int main()
{
double x0,x,h,e,e1,y0,y1,y2,k0,k... |
C | /* tz_geo3d_circle.c
*
* 18-Mar-2008 Initial write: Ting Zhao
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <utilities.h>
#include "tz_error.h"
#include "tz_constant.h"
#include "tz_geo3d_utils.h"
#include "tz_geo3d_circle.h"
#include "tz_swc_cell.h"
#include "tz_math.h"
G... |
C | #ifndef BOARD_H
#define BOARD_H
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <math.h>
#include "chess_errors.h"
#include "position.h"
#include "../pieces/pieces.h"
#define True 1
#define False 0
#define DIMENSIONS 8
typedef uint8_t Bool;
typedef struct ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
// ENUM é tipo de dado definido pelo usuário que define uma variável que vai receber apenas um conjunto restrito de valores.
// Representa um conjunto de valores inteiros representados por identificadores.
typedef enum boolean{false=0, true=1} Boolean;
// O ... |
C | #include <stdio.h>
#include <string.h>
int main() {
char c1[1024], c2[1024], temp[1024];
int pos;
scanf("%s %s %d", c1, c2, &pos);
for (int i = 1; i < pos; i++) {
strcpy(temp, c1);
strcpy(c1, c2);
strcpy(c2, temp);
strcat(c2, c1);
}
printf("%s", c1);
return 0;... |
C | #include <pthread.h>
#include <stdio.h>
#include <unistd.h>
#include <time.h>
#include <fcntl.h>
#include "functions.h"
#include <sys/file.h>
void* reader(void *result){
int i, fd;
int aux = NUMBER_OF_LINES*POSITION_OF_NEWLINE;
int lineCounter=0;
char currentChar;
char* buf = (char*)malloc(sizeof(char)*(aux+1))... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_countxX.c :+: :+: :+: ... |
C | #include "helper.h"
#include <stdlib.h>
#include <string.h>
int rand_int(const int min, const int max)
{
int ret;
do {
ret = min + rand() / ((RAND_MAX + 1u) / (max - min + 1));
} while (ret > max);
return ret;
}
char *strip_newline(char *const restrict str)
{
str[strcspn(str, "\n")] = '\0'... |
C | #include "open_lock.h"
#include "send_data.h"
#include "rece_data.h"
#include "check_protocol.h"
static unsigned char check_data[5] = {0xFC,0x01,0x01,0xCC,0x01};
void check_data_init()
{
check_data[0] = CHECK_PROTOCOL_FIR;
check_data[1] = CHECK_BOARD_ADDR_INIT;
check_data[2] = CHECK_LOCK_ADDR_INIT;
check_data[3... |
C | //B171381
//Implementation of queue using doublelinkedlist
#include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node *next,*prev;
};
struct node *top=NULL;
struct node* push(int ele);
struct node* pop();
void display();
void main()
{
int ele,ch;
printf("1.push\n2.pop\n3.display\n4.exit\n");
do
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* support.c :+: :+: :+: ... |
C | #include<stdio.h>
int main(void)
{
long unsigned int *p = NULL;
printf("%d\n",sizeof(*p));
}
//(typedef int *ptr; ptr p =NULL;)
//(sizeof(all type *)=4,
|
C | #include <stdio.h>
#include <unistd.h>
#include <malloc.h>
#include <pthread.h>
#include <mqueue.h>
#include "peripherals_manager.h"
#include "common.h"
#define MAX_MSG_SIZE 256
// queue descriptor
mqd_t pm_queue;
// array for queue elements
pm_message rcvd_msgs[PANIC_TREAD_QUEUE_SIZE];
int last_msg_index = 0;
v... |
C | //
// Created by william on 2018/12/4.
//
#include "select.h"
#include "sort_check.h"
#include "sort_tool.h"
void extremum(ElementType const arr[], int lo, int hi, int *max, int *min) {
*max = *min = lo;
ElementType v = arr[hi];
while (lo <= hi) {
if (compare(v, arr[*min]) <= 0) *min = hi;
... |
C | #include <stdlib.h>
#include "hw1.h"
#include "debug.h"
#include "pcipher.h"
#include "fcipher.h"
#ifdef _STRING_H
#error "Do not #include <string.h>. You will get a ZERO."
#endif
#ifdef _STRINGS_H
#error "Do not #include <strings.h>. You will get a ZERO."
#endif
#ifdef _CTYPE_H
#error "Do not #include <ctype.h>. Y... |
C | #include<stdio.h>
#include<stdlib.h>
void display(int a1[],int n)
{ int i;
for(i=0;i<n;i++)
printf("%d ",a1[i]);
printf("\n");
}
int* getRecord(int s_size, int* s, int *result_size)
{
int i,c=0,d=0,size=2;
int *a1,*a2;
a1=(int *)malloc(sizeof(int)*s_size);
a2=(int *)malloc(sizeof(int)*s_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ncurses.h>
#include <sys/stat.h>
#include "ftlsg.h"
int main(int argc, char **argv)
{
// variables required to read file
FILE *file;
char *buffer;
char argbuffer[256];
unsigned long fileLen;
SAVEGAME save;
//
// VERIF... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
struct point {
int x;
int y;
};
struct line {
struct point p1;
struct point p2;
};
char *read_input(char *filename, size_t *out_size) {
char *output;
FILE *f;
size_t size;
if (!filename) return NULL;
f = fopen(filename,... |
C | #include "std.h"
#include "table.h"
#include "get_word.h"
#include "lexicon.h"
#include "network.h"
// max_states is the maximum number of states allowed in the network.
const int max_states = 50;
const char *network_file = "network";
// The network is stored in a table of states. Each is referenced by
// i... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node
{
int data; //node will store an integer
struct node *right,*left;
}node;
node* root=NULL;
node* add_node(node* temp,int value)
{
if(temp==NULL)
{
temp=(node*)malloc(sizeof(node));
temp->data=value;
temp->left=temp->right=NU... |
C | #include <stdio.h>
void reverse(/*unsigned char *input*/)
{
//int v4 = 1337;
int v1;
unsigned char *v5;
unsigned char v3;
unsigned char input[255];
while (1)
{
scanf("%s", input);
v5 = input;
v3 = *v5;
int v4 = 1337;
do
{
v1 = 32 * v4 + v3;
v3 = (v5++)[1];
v4 += v1;
} while (v3);
pr... |
C | /*
#include <stdio.h>
int main(void) {
FILE * ms = fopen("C:/Users/tkskd/Desktop/mystroy.txt", "wt");
if (ms == NULL) {
puts(" !");
return -1;
}
fputs("#̸: \n", ms);
fputs("#ֹιȣ: 900112-1234567\n", ms);
fputs("#ȭȣ: 010-4322-8956\n", ms);
fclose(ms);
return 0;
}
*/ |
C | #include <stdio.h>
int main()
{
printf("simple.c\n");
printf("To compile and run simply type: \"gcc simple.c -o simple.exe && ./simple.exe\"\n");
return 0;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* last_sort.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.c :+: :+: :+: ... |
C | #include "holberton.h"
/**
*cap_string - capitalizes the first letter in a world
*@s: string
*Return: a string
*/
char *cap_string(char *s)
{
int counter = 0;
if ((s[counter] >= 'a' || (s[counter] <= 'z' && !(s[counter] < 'a'))))
s[counter] -= 32;
while (s[counter] != '\0')
{
if ((s[counter - 1]) && (s[counter - ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mapping.h"
DWORD reverseBits(DWORD x){
x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
x = (((x & 0xff00ff00) ... |
C | #include<stdio.h>
#include<stdlib.h>
void main()
{
char filename[20];
printf("Enter file name to be read:");
scanf("%s",filename);
print_fivechar(filename);
}
void print_fivechar(char *f)
{
FILE *fp;
char ch;
int no=0;
fp=fopen(f,"r");
printf("Last five character are ===> ");
fseek(fp,-20,SEEK_END);
/*if(fseek(... |
C | /* Esercizio 15
Scrivere un programma in C che legga da tastiera 12 interi e inserisca i primi
6 nell’array a e gli altri nell’array b. Dichiarare inoltre un terzo array c di 3
elementi.
Scrivere poi una procedura che calcoli il prodotti tra gli elementi pari dell’array
a e gli elementi dispari dell’array b e li inseri... |
C | #include "common.h"
// simple write-ahead logging for atomic file replacement
#define DATABUF_SIZE 4096
struct wal_checksum {
unsigned char digest[20];
};
static int calc_file_checksum(FILE *fp, struct wal_checksum *csum)
{
int success = 1;
unsigned char databuf[DATABUF_SIZE];
size_t datalen;
S... |
C | #include "thread_qsort.h"
void swap(int *a, int *b) {
int c = *a;
*a = *b;
*b = c;
}
int cmp(const void *a, const void *b) {
return *((int*) a) - *((int*) b);
}
void thqsort_real_sort(void *_arg) {
struct TaskArg *arg = _arg;
if (arg->sz <= 1) return;
if (arg->depth == 0) {
... |
C | #include <stdio.h>
#include <locale.h>
#include <math.h>
// LEIA UM NUMERO REAL E IMPRIMA O RESULTADO DO QUADRADO DESSE NUMERO
int main(){
float num;
scanf("%f", &num);
printf("%f", pow(num, 2));
}
|
C | /*
óʾʹnoneblock дԱƶ˻߱ƵĵӦá
ʵֿõƾ߶ʱ ԼʱЧ
nbеĶʱʵ ԵƾߵĿƣЧҲöʱʵ֡
ʾ:
1nbܽ
2ͨnbܵinvoke һ()
3nbĶʱӦã
4pwm
5jsonίнӿڵʹ(jsonίнӿhttpdotdĬϵⲿӿ)
*/
#include "include.h"
/*
ģ:
ʽ:
{
"method":"dollcatch.steer",
"params":"U"\"D" \"L"\"R" \"F"\"B"
}
*/
#define NB_NAME "dollcatch"
//ﶨҪʹЩ ԼһЩΪĺ궨
#define IO1 WIFIIO_GPIO_17
#... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int large, slarge, a,b,c;
clrscr();
printf("================================\n\n");
printf("Finding Largest and Second largest Among 3 Nos\n\n");
printf("================================\n\n");
printf("Enter 3 Numbers");
scanf("%d%d%d",&a,&b,&c);
if((a>b)&&(a>c)... |
C | /// III.SINGLY LINKED LIST ///
// 14.ADDING NEW NODE BEFORE A GIVEN NODE //
#include<stdio.h>
#include<stdlib.h>
struct node {
int data;
struct node *next;
};
typedef struct node NODE;
NODE *Create_Node(int data){
NODE *ptr = (NODE *)malloc(sizeof(struct node));
ptr->data = data;
... |
C | #include<stdio.h>
int main()
{
int a,b;
FILE *fp;
fp=fopen("f1.txt","w");
printf("Enter two numbers\n");
scanf("%d %d",&a,&b);
fprintf(fp,"Sum of %d & %d is %d",a,b,a+b);
fclose(fp);
}
|
C |
#include "arena.h"
void push_free_stack( struct slab_struct *slab ){
// add necessary code
struct slab_struct *rover=free_stack;
struct slab_struct *dover=slab;
struct slab_struct *end;
if(slab==NULL)
return;
while(dover->next!=NULL){
dover=dover->next;
}
end=dover;
while(rov... |
C | #include "rbtree.h"
/* -------------------------------------------- */
/* Private interface : */
/* binary search tree with red-black coloring */
/* -------------------------------------------- */
/* -------------------------------------------- */
/* Type definition : ... |
C | #include<stdio.h>
#include<stdlib.h>
struct Emp {
int eid;
char ename[20];
float esal;
};
int main(){
struct Emp *ptr;
ptr=(struct Emp *)malloc(sizeof(struct Emp));
if(ptr==NULL){
printf("memory allocation fails");
}
else{
printf("Enter employee details");
scanf("%d... |
C | #include<iostream>
#include<memory>
#include<stack>
using namespace std;
struct Node
{
int data;
Node *left;
Node *right;
};
Node *allocateNode(int data)
{
Node *temp = new Node;
temp->data = data;
temp->left = NULL;
temp->right = NULL;
return temp;
}
void printSp... |
C | typedef struct DuLNode {
ElemType data;
struct DuLNode *prior;
struct DuLNode *next;
} DuLNode, *DuLinkList;
// 空的双向循环链表
L->next == L->prior == L;
// 在带表头结点的双向循环链表 L 中 P 结点之前插入结点 S
void ListInsert_DuL(DuLinkList &L, DuLNode *p, DuLNode *s) {
s->prior = p->prior;
s->next = p;
p->prior->next = ... |
C | #include <stdio.h>
#include <string.h>
int sort_word(char *word1, char *word2);
void insertion_sort(char *word1,char *word2,int n);
void verify_anagram(char *word1,char *word2,int n);
int main()
{
char word1[20],word2[20];
printf("Enter first word in uppercase letters= ");
fgets(word1,20,stdin);
prin... |
C | #include <lpc214x.h> / if in local folder use "lpc214x.h"
#include <stdint.h>
//Sin = 512 + (511*sin((360*n)/42))
void delay_ms(uint16_t j)
{
uint16_t x,i;
for(i=0;i<j;i++)
{
for(x=0; x<6000; x++); /* loop to generate 1 ms
delay with Cclk = 60MHz */
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_itoa_base.c :+: :+: :+: ... |
C | #include<stdio.h>
int isleap(int year)
{
if(year%400==0)
{
return 0;
}
else if(year%100==0)
{
return 1;
}
else if(year%4==0)
{ return 2;
}
else
{
return -1;
}
}
int main()
{
int year,r;
printf("enter the year \n");
sca... |
C | #ifndef _PAGE_FAULT_HANDLER_H
#define _PAGE_FAULT_HANDLER_H
#include <defs.h>
/**
* When page fault occurs:
* (1) Check address that caused fault
* (2) Check if memory area exists for the address
* (3) If yes, add a physical page for the location with required protection
* (4) In case of file backed vma, load fi... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: ... |
C | /*
** create_tab.c for 42sh.h in /u/epitech_2012/sellie_a/cu/42sh/mysh
**
** Made by arnaud sellier
** Login <sellie_a@epitech.net>
**
** Started on Wed Jun 11 15:27:14 2008 arnaud sellier
** Last update Thu Jun 12 16:38:24 2008 arnaud sellier
*/
#include "42sh.h"
void free_completion_tab(t_vector *target)
{
i... |
C | #include <gumo/renderer/shader.h>
#include <gl/glew.h>
#include <glfw/glfw3.h>
#include <stdio.h>
const color_t COLOR_BLUE = {0.2f, 0.3f, 0.8f, 1.0f};
const color_t COLOR_RED = {0.8f, 0.3f, 0.2f, 1.0f};
const color_t COLOR_GREEN = {0.2f, 0.8f, 0.3f, 1.0f};
const color_t COLOR_WHITE = {1.0f, 1.0f, 1.0f, 1.0f};
const co... |
C | /**
* sigLib, simple Signals Library
*
* Copyright (C) 2013 Charles-Henri Mousset
*
* This file is part of sigLib.
*
* sigLib is free software: you can redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of... |
C |
//这是一个简单的udpk客户端
//
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<errno.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<unistd.h>
int main()
{
int sockfd=socket(AF_INET,SOCK_DGRAM,IPPROTO_UDP);
if(sockfd<0)
perror("create error");
//client need not bind;
... |
C | #include "globalv.h"
//Puts in random data in a non-life cell
void randomSpawner(int numOfOrganismsToSpawn, int length, int width) {
srand(time(NULL));
int i,j,count;
extern TableType table;
count = 0;
while(count < numOfOrganismsToSpawn){
i=rand()%length;
j=rand()%width;
... |
C |
/// Taken from Posix Tutorial -- https://computing.llnl.gov/tutorials/pthreads/
// Example demonstrates Mutex control over Pies. Now add a Pie Producer
// And then a conditional ?
// R. Trenary, 1/26/12
//
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#define NUM_THREADS 5
int Done [NUM_THREADS... |
C | #include <stdio.h>
#include <ctype.h>
int main()
{
int ch;
while((ch=getchar())!=EOF) {
if(islower(ch))
ch=toupper(ch);
else if(isupper(ch))
ch=tolower(ch);
putchar(ch);
}
putchar('\n');
}
|
C | /***********************************************************************
* Copyright (C) 2018 junfu0903@aliyun.com All rights reserved.
* * File Name: main.c
* Brief: 本程序模拟简单的音乐播放器的控制流程
* Author: frank
* Email: junfu0903@aliyun.com
* Version: 1.0
* Created Time:2018-08-23 22:48:22
* Blog: http:... |
C | // Example C program for bit-banging synchronous communication.
//
// This program sends an array of curr_bytes. For each curr_byte, bits are sent from least
// significant to most significant by setting the data pin to 0/1 after each
// positive clock edge.
// gpo(0): clock pin, with period PERIOD and ~50% duty cycle
... |
C | //
// sudokuStrategies.c
// projetofinal
//
// Created by Faculdade on 28/12/2019.
// Copyright © 2019 Patricia. All rights reserved.
//
#include "sudokuStrategies.h"
MATRIX * create_Vetor_Strategies(MATRIX *pM){
CELL * c= pM->pfirst, *aux=c;
int size =pM->size;
for(int i=0;i<size;i++){
(c->p)... |
C | #include"header.h"
int validate(char* num)
{
int i;
int n=0;
int flag=0;
if(num[0]=='+') {
flag=0;
}
else if(num[0]=='-') {
flag=1;
}
else if((num[0] >= '0') && (num[0] <= '9')){
n = n * 10 + num[0] - '0';
}
for(i = 1; i < str_len(num)-1; i++) {
if ((num[i] >= '0') && (num[i] <= '9'))
{
... |
C | #include<stdio.h>
double pi(unsigned int n);
int main(void){
double pivar;
unsigned int i;
for(i=1; i<=1000000000; i*=10){
pivar = pi(i);
printf(" %10d = %lf \n",i,pivar);
}
return 0;
}
double pi(unsigned int n){
int pm=0;
unsigned int i;
double pivar=0;
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.