language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "formula.h"
#include "../eqtypes.h"
#include "../common.h"
#include "../mul.h"
#include "../transform.h"
#include "../starmath.h"
#include "../debug/debug.h"
#ifdef OS_WINDOWS
#define swprintf _snwprintf
#endif
// release memory
static void Formula_dealloc(FormulaObject *self)
{
if( self->equation !=... |
C | #include <unistd.h>
#include <stdio.h>
#include <signal.h>
void sigroutine(int unused) {
printf("Catch a signal SIGINT ");
}
int main() {
signal(SIGINT, sigroutine);
pause();
printf("receive a signal ");
}
|
C | /* SPDX-License-Identifier: GPL-2.0 */
int find_first(int v, const int x[], int n)
{
int l, u;
l = -1, u = n;
while (l+1 != u) {
int m = (l+u)/2;
if (x[m] < v)
l = m;
else
u = m;
}
if (u >= n || x[u] != v)
return -1;
return u;
}
|
C | #include "pilhaD.h"
#include <stdio.h>
#include <stdlib.h>
int **criaMatriz(int n) {
int i;
int **matriz;
matriz = malloc (n*sizeof(int *));
if(matriz != NULL)
for (i=0; i<n; i++) {
matriz[i] = malloc (n*sizeof(int));
if(matriz[i] == NULL) printf("\n n alocou");
}
return matriz;
}
void zeraMatriz(int *... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct node{
int data; //node sum
int no; //node ka data
struct node* next;
}link;
typedef struct node1{
int data;
struct node1* left;
struct node1* right;
}tree;
link* head = NULL;
void push(int i, int node)
{
if(head == NULL)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int teststring(char str1[20], char str2[20]){
int ta, tb, flag=1, i;
ta=strlen(str1);
tb=strlen(str2);
if (ta==tb){
for (i=0 ; i<ta && flag ; i++)
if (str1[i]!=str2[i]) flag = 0;
}
else flag = 0;
return flag;
}
int main(){
char nome1[20], no... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
/* BUSCA LINEAR COM STRUCT*/
typedef struct
{
int matricula;
char nome[30];
int nota;
} Aluno;
int busca_Linear_nome (Aluno *V, int N, char nome[])
{
int i;
for(i=0; i<N; i++)
if (strcmp(nome,V[i].nome)==0){
printf ("\nNo... |
C | extern void __VERIFIER_error(void);
extern void __VERIFIER_assume(int);
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR: __VERIFIER_error();
}
return;
}
int __VERIFIER_nondet_int();
void main()
{
int X;
int Y;
int r;
int l;
r = X;
__VERIFIER_assume(X >= 0 &&... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | /*Thiago Santos Teixeira nUSP 10736987 */
#ifndef __TABELASIMBOLO_VD_H
#define __TABELASIMBOLO_VD_H
/*esta é uma função de mergeSort que ira ordenar um vetor de uma struct, a
*ordenção ira depender da variavel tipoOrd(pode ser por frequencia ou
*alfabeticamente).
*/
void mergeSortVD(int inicio, int fim, stableV *sta... |
C | #define EPS (10E-8)
#define K_MAX (100)
#include "stdio.h"
#include "libs/bspedupack.h"
#include "libs/debug.h"
#define DUMP( n, a ) for(counter0=0;counter0<n;counter0++) printf("dump array[%d]=%lf\n",counter0, a[counter0])
void cg_test();
int N;
int main(int argc, char** argv) {
printf("Starting CG, sequential... |
C | #include <stdio.h>
int main() {
int N, L;
scanf("%d %d", &N, &L);
int temp, flag, cnt = 0;
for (int i = 1;; i++) {
temp = i, flag = 1;
while (temp != 0) {
if(temp%10 == L){
flag = 0;
}
temp /= 10;
}
if (flag == 1) {
//printf("i : %d\n", i);
cnt++;
if (cnt == N) {
... |
C | /**
* @file Scheduler.h
* @brief Scheduler Header File for this program
* @author Mohammed Awwad
* @date 10/7/2020
* @version 1.0
*/
//--------------------- Header Guard -------------------------------
#ifndef SCHEDULER_H_
#define SCHEDULER_H_
// ------------------ File Inclusions ----------... |
C | #include "isotp.h"
#include <stdio.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>
#include "sys/time.h"
#include <pthread.h>
#include "comm_typedef.h"
#define CLIENT_ADDRESS 0x766
#define SERVER_ADDRESS 0x706
static ERROR_CODE sender_test_send(struct phy_msg_t *msg);
static ERROR_CODE sender_test_r... |
C | #include <stdio.h>
char *
strdup (strptr)
char *strptr;
{
char *charptr;
charptr = (char *) malloc (sizeof (char) * strlen (strptr) + 1);
if (charptr == NULL)
return (charptr);
strcpy (charptr, strptr);
return (charptr);
}
|
C | #include <stdio.h>
#include <stdlib.h>
typedef struct{
char nombre[50];
int pos;
} jugador;
typedef struct{
char pregunta[400];
char op[4][1024];
int resp;
} quizz;
typedef struct {
int num_op;
int num_preg;
int gameOver; //como bandera
int turno;
int itPreg;
int categoria;
int numJug... |
C | #include <stdio.h>
int main(void){
int v, t;
scanf("%d",&t);
scanf("%d",&v);
printf("%.3lf\n",(v*t/12.0));
return 0;
} |
C | #include <stdio.h>
#include <rpc/rpc.h> /* always needed */
#include "msg.h" /* msg.h wil be generated by rpcgen */
int main(int argc, char *argv[])
{
CLIENT *cl;
int *result;
char *server;
char *message;
if (argc != 3) {
fprintf(stderr,
"usage %s host message... |
C | #include "compare.h"
int search(Element x, Element A[], int N)
{
int i;
for(i=0;i<N;i++)
{
if(A[i]==x)
return i;
if(compare(A[i],x))
return -1;
}
return -1;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_checku.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <time.h>
#include <sys/wait.h>
int main(){
printf("START FORKING!\n");
pid_t childA, childB;
srand(time(NULL));
printf("parent pid: %d\n", getppid());
childA = fork();
if (childA)
childB = fork();
if (childA == 0 ... |
C | #include <stdio.h>
#include <string.h>
#include <malloc.h>
#define APN_STR "Init%d = AT+CGDCONT=1,\"IP\",\"ANETAPN\"\n"
int main(int argc, char **argv)
{
FILE *fp;
char *buff = NULL;
fp = fopen("m.conf", "r");
if ( fp ) {
char *line = NULL;
int line_num = 0;
int i = 0;
int c;
char apn_set = 0;
wh... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "disk.h"
#include "get.h"
/**************************************************************************
ADDNOISE.C - PROGRAM TO ADD NOISE TO EXISTING DSP DATA OR CREATE
NOISE ONLY. ADDS NOISE TO FIRST RECORD OF INPUT FILE
AND... |
C | #include <stdio.h>
#include <string.h>
/* 12503 - Robot Instructions
Sample Input
2
3
LEFT
RIGHT
SAME AS 2
5
LEFT
SAME AS 1
SAME AS 2
SAME AS 1
SAME AS 4
Sample Output
1
-5
*/
int main() {
int test_cases, i, n, number, instructions[101], robot;
char instruction[10];
scanf("%d", &test... |
C | // Вывести количество различных битовых последовательностей заданной длины (не более 32), не содержащих двух единиц подряд.
#include <stdio.h>
int maxPow(int len) {
int base2 = 1;
for ( int i = 1; i < len; base2 *= 2, i++ );
return base2;
}
int bitSequences(int maxValue, int len, int count) {
... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char s[1000];
int i,a=0,b=0,c=0;
gets(s);
for (i=0;i<strlen(s);i++)
{
if ((s[i]<='z' && s[i]>='a')||(s[i]<='Z' && s[i]>='A'))
a++;
else if (s[i] >= '0' && s[i] <= '9')
b++;
else c++;
}
printf("%... |
C | #include <stdio.h>
void printlist(int v[]);
void swap(int v[], int i, int j);
void qsort(int v[], int left, int right);
int main(void){
int list[]= {5,7,3,6,2,8,1,0,9,4};
printlist(list);
qsort(list, 0, 9);
printlist(list);
}
void qsort(int v[], int left, int right) {
if (left >= right)
return;
swap(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SHL(x,n) (x<<n)
#define SHR(x,n) (x>>n)
#define ROTL(x,n) ((x<<n)|(x>>(32-n)))
#define ROTR(x,n) ((x>>n)|(x<<(32-n)))
#define P1(a,b,c,d,e) (P2((a)^(b)^ROTL((c),15))^ROTL((d),7)^e)
#define P2(a) ((a)^ROTL((a),15)^ROTL((a),23))
#define P3(a,b) ((a)^(b)... |
C | #include "holberton.h"
/**
* reverse_array - reverses the content of an array of integers
*
* @a: A pointer to first integer in array.
* @n: An integer for number of elements in array.
*
* Return: void
*/
void reverse_array(int *a, int n)
{
int i;
int temp;
int len;
temp = 0;
len = (n - 1) / 2;
n -= 1;
... |
C | /*Input: Q = {WRITE A, WRITE B, WRITE C, UNDO, READ, REDO, READ}
Output: AB ABC
Explanation:
Perform WRITE A on the document. Therefore, the document contains only A.
Perform WRITE B on the document. Therefore, the document contains AB.
Perform WRITE C on the document. Therefore, the document contains ABC.
Perfor... |
C | /* exception.c: handle processor exceptions and suprisingly NMIs too */
/* basically started as a hacked around version of irq.c */
/* then I deleted most of that code and instead used irq.c as a model */
#include <kernel/kernel.h>
#include <asm/init.h>
#include <asm/system.h>
#include <asm/lock.h>
#include <kernel/ta... |
C | // Shellcode.c
// Opens a shell as effective UID of 0
#include <unistd.h>
void main(void) {
char *name[2];
name[0] = "/bin/sh";
name[1] = NULL;
execve(name[0], name, NULL);
} |
C | #include<stdio.h>
#include<math.h>
#define MAX 100
#include"headerofsquare.h"
void nhap(int a[],int n){
for(int i=0;i<n;i++){
printf("Nhap phan tu thu a[%d]",i+1);
scanf("%d",&a[i]);
}
}
void xuat(int a[],int n){
for (int i=0;i<n;i++){
printf("mang la %d \n",a[i]);
}... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#if defined(_MSC_VER)
#include "xxhash.h" //random string
#include <windows.h> //sleep
#include <intrin.h> //rdtsc
#pragma intrinsic(__rdtsc)
#else
#include <linux/types.h> //rdtsc
#include <unistd.h> //sleep
... |
C | //
// Created by vitor on 3/28/21.
//
#include "bridge.h"
int bridgeLinked(GrafoLinked grafo) {
printf("\nEntre com 1º vertice que deseja: ");
int v_one = get_int();
if (v_one <= 0 || v_one > grafo.numVertices) {
printf("\n\tNumero de vertice invalido!\n\n");
return 0;
}
printf("E... |
C | /*Write a function setbits that returns x
with the n bits at position p set to the rightmost bits of y
leaving the other bits unchanged*/
#include <stdio.h>
#include <math.h>
unsigned getbits(unsigned x, int p, int n);
unsigned setbits(unsigned x, int p, int n, unsigned y);
void main(char args[]){
//x = 100... |
C | #include "cache.h"
#include "simerr.h"
#include <stdlib.h>
cache_t sim_icache;
cache_t sim_dcache;
int missTime=100;
void
init_cache(cache_t *cache, int s, int l, int b)
{
int i;
cache->nSetBits = 0;
for (i=1; i<s; i<<=1) {
cache->nSetBits++;
}
cache->nLines = l;
cache->nBits = b... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
int primeOrNot(int num) {
for(int i = 2; i <= sqrt(num); i++) {
if((num % i) == 0) {
return 0;
}
}
return 1;
}
int armstrongOrNot(int num) {
int len = 0, tempNum = num, tempSum = 0;
... |
C | //
// CLRS_Fibonacci_2.c
// algorithms-iOS
//
// Created by Tonny Xu on 2/6/12.
// Copyright (c) 2012 Tonny Xu. All rights reserved.
//
#include <stdio.h>
#include <sys/time.h>
#include <limits.h>
#include <math.h>
#include <stdlib.h>
#include <inttypes.h>
#import "CLRS_CommonFunctions.h"
#import "CLRS_NaiveAlgor... |
C | #include <stdio.h>
#include <stdlib.h>
//get int pointer as parameter and increment it value by one
void inc(int *w) {
*w = *w + 1;
}
int main() {
int x = 123;
int y = x;
//call inc function and pass y memory address
inc(&y);
printf("%d,%d\n", x, y);
return EXIT_SUCCESS;
}
|
C | //
// sorting.h
// Created by Anjali Malik
//
//
#ifndef sorting_h
#define sorting_h
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <time.h>
//to store integers
typedef struct _Node{
long value;
struct _Node *next;
}Node;
//for multiple linked lists
typedef struct _List{
Node *no... |
C | //////////////////////////////////////////////////////////////////////////////
// //
// Exemple de communication radio avec un terminal RS232 //
//--------------------------------------------------------------------------//
// //
// Ce programme montre comment tablir une communic... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf_conv_int_hh_utils.c :+: :+: :+: ... |
C | /***************************************************************************************
* *
* NET DOWN - qualix DEVELOPS - www.qualix.com.ar *
* Cliente *
*************************************************... |
C | # include <stdio.h>
# include "gen.h"
# include "../h/dbs.h"
# include "../h/aux.h"
# include "../h/pipes.h"
# include "../h/tree.h"
# include "../h/symbol.h"
# include "parser.h"
struct atstash *Freeatt; /* free list of attrib stash */
static struct rngtab Rngtab[MAXVAR + 1]; /* range table */
static struct atstas... |
C | #include<stdio.h>
int p[200];
int judge(int x,int n){
int i;
for(i=0;i<n;i++){
if(p[i] == x){
return 1;
}
}
return 0;
}
int main(){
int x,n;
scanf("%d%d",&x,&n);
if(n == 0){
printf("%d\n",x);
return 0;
}
int i;
for(... |
C | #include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;
struct node *prev;
};
struct node *head=NULL;
struct node *tail=NULL;
void insertBegg(){
int data;
printf("insert a number to insert\n");
scanf("%d",&data);
struct node *temp=(struct node*)malloc(sizeof(struct node)... |
C | #ifndef PLAYER_H_
#define PLAYER_H_
#include <map.h>
#include <constant.h>
#include <bomb.h>
#include <game.h>
struct player;
// Creates a new player with a given number of available bombs
struct player* player_init(int bomb_number);
void player_free(struct player* player);
// Returns the current position of the ... |
C | /* 9. Write macros for the following using bitwise operations:
a. To find maximum and minimum of 2 numbers
b. To clear right most set bit in a number
c. To clear left most set bit in a number
d. To set right most cleared bit in a number
e. To set left most cleared bit in a number
f. To set bits from bit position ‘s’ to... |
C |
#include<stdio.h>
#include<conio.h>
int main()
{ char name[20];
printf("enter ur name\n");
gets(name);
printf("hi u r a good boy\n%s",name);
getch();
return 0;
}
|
C | /******************************************************************************/
// Bullfrog Engine Emulation Library - for use to remake classic games like
// Syndicate Wars, Magic Carpet or Dungeon Keeper.
/******************************************************************************/
/** @file bflib_bufrw.c
* ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "casa.h"
#include "quadtree.h"
#include "ponto.h"
typedef struct casa
{
int n;
char face;
double w, h, n_x, n_y;
ponto coord;
} objCasa;
casa montaCasa(int n, char *cep, char *face, int num, QuadTree quadras){
... |
C | /*
Chef is interested in the history of SnackDown contests. He needs a program to verify if SnackDown was hosted in a given year.
SnackDown was hosted by CodeChef in the following years: 2010, 2015, 2016, 2017 and 2019.
Input
The first line contain the number of test-cases T.
The first line of each test-case conta... |
C | #include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int i,n,k,item[10000],sum=0,total=0;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%d",&item[i]);
for(i=0;i<n;i++)
{
if(item[i]>k)
sum+=item[i]-k;
}
pr... |
C | #include <stdio.h>
char * find(char *, char);
int main(void) {
char str[80];
char c;
while (scanf("%s %c", str, &c) > 0) {
printf("%p %c\n", find(str, c), *find(str, c));
printf("again~\n");
}
return 0;
}
char * find(char * str, char c) {
while (*str != '\0') {
if (... |
C | #include <stdio.h>
#include <wiringPi.h>
int ultrasonic_R_trig = 24;
int ultrasonic_R_echo = 25;
int ultrasonic_L_trig = 26;
int ultrasonic_L_echo = 27;
int ultrasonic_F_trig = 28;
int ultrasonic_F_echo = 29;
float start_time_R;
float start_time_L;
float start_time_F;
float end_time_R;
float end_time_L;
float end_tim... |
C | #include "inline_table.h"
static void printInlineTableElement (const InlineTable * table);
InlineTable * inlineTableFromKeyPair (KeyPair * pair)
{
assert (pair != NULL);
InlineTable * table = malloc (sizeof (InlineTable));
table->pair = pair;
table->next = NULL;
return table;
}
InlineTable * pushPair (InlineTab... |
C |
#include "km0/device/boardIo.h"
#include "km0/device/digitalIo.h"
static int8_t pin_led1 = -1;
static int8_t pin_led2 = -1;
static bool invert_output_logic = false;
void boardIo_setupLeds(int8_t pin1, int8_t pin2, bool invert) {
pin_led1 = pin1;
pin_led2 = pin2;
invert_output_logic = invert;
if (pin_led1 != ... |
C | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
int min(int i,int j)
{
if(i<j)
return i;
else
return j;
}
int bin_coff(int n,int k)
{
int c[k+1];
int i,j;
memset(c,0,sizeof(c));
c[0]=1;
for(i=0;i<=n;i++)
{
for(j=min(i,k);j>0;j--)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
int dbglvl = 4;
#define FUDGE_BUF (100*1024)
#define MAX_SPEC_FD 2
struct spec_fd_t {
int limit;
int len;
int pos;
unsigned char *buf;
} spec_fd[MAX_SPEC_FD];
int spec_init() {
int i, j;
!dbglvl;
/* Allocate some... |
C | #include <stdio.h>
#include <stdlib.h>
int foo(int*a,int*b)
{
if (*a>*b)
return *b;
return *a;
}
int main()
{
int tab[] = {1,2,-3,2,9,8,1,-2,3,4};
int *wsk=tab-1;
int b = *(wsk+=4); //b=2
int c = b+4; // b=2 , c=6
int d = foo(&b,&c); // b=2 , c=6 , d=2
int e... |
C | // Problem 6: Sum square difference
//
// Find the difference between the sum of the squares and the square of the sum of the first hundred naturals.
#include <stdio.h>
#define BOUND 100
int main(void) {
int squareSum = 0;
int sumSquare = 0;
for (int i = 1; i <= BOUND; i++) {
squareSu... |
C | #ifndef UMSECTIONS_INCLUDED
#define UMSECTIONS_INCLUDED
/* Full documentation for this interface is at http://tinyurl.com/2uwhhtu */
#include <stdint.h>
#include <stdio.h>
//#include <stdlib.h>
#include <seq.h>
#include <table.h>
#include <atom.h>
#include <mem.h>
#include <malloc.h>
#include <bitpack.h>
#define T Umse... |
C | /* --------------------------- */
// Student: Michel Baartman
// StuNummer: 1696929
// Docent: Jorn Bunk
// Opdracht: week 5 opdracht 1
/* --------------------------- */
/// @file
/// w5o1 Week 5 Opdracht 1
/// Checkes if array is sorted or not, counting upwards and starting from the back.
#include <std... |
C | #include <unistd.h>
#include <limits.h>
#include <syslog.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <pwd.h>
#include <fcntl.h>
#include <dirent.h>
/* recommended version, as per fuse.h */
#define FUSE_USE_VE... |
C | /*
* scafContigIndex.c
*
* Created on: Jan 9, 2014
* Author: zhuxiao
*/
#include "inc/stdinc.h"
#include "inc/extvab.h"
/**
* Build the scafContigIndex.
* @return:
* If succeeds, return SUCCESSFUL; otherwise, return FAILED.
*/
short buildScafContigIndex(scafContigIndex_t **scafContigIndex, contigGr... |
C | #include <stdio.h>
#include <stdlib.h>
void remove_duplicates(int n,int *a);
void remove_duplicates(int n,int *a)
{
int c,*b,count=0,d;
b=(int*)malloc(n*sizeof(int));
for (c = 0; c < n; c++)
{
for (d = 0; d < count; d++)
{
if(a[c] == b[d])
break;
}
if (d == coun... |
C | /******************************************************************************
* tcp_server.c
*
* CPE 464 - Program 1
* Lance Boettcher
*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
int dp[700][700][700];
int solv(int i, int j, int k)
{
int first, second, third, forth;
int min;
if(i==0 || j==0 || k==0)
return 1;
if(dp[i][j][k]>=0)
return dp[i][j][k];
if(dp[i-1][j-1][k-1]>=0)
first=dp[i-1][j-1][... |
C | #include <stdio.h>
int main(void){
int no;
do{
printf("Please enter an integer:");
scanf("%d",&no);
if (no<=0){
printf("Do not enter negative number");
};
}while(no<=0);
printf("The reverse of the number is:");
while(no>0){
printf("%d",no%10);
... |
C | /*
* =====================================================================================
*
* Filename: getSubSeq.c
*
* Description: get sequences from a fasta file according to coordinates
*
* Version: 1.0
* Created: 2015/11/09 22时07分39秒
* Revision: none
* Compiler: ... |
C | /**
* \file vccrypt_suite_buffer_init_for_cipher_key_agreement_private_key.c
*
* Initialize a crypto buffer sized appropriately for the suite cipher key
* agreement private key.
*
* \copyright 2017 Velo Payments, Inc. All rights reserved.
*/
#include <cbmc/model_assert.h>
#include <string.h>
#include <vccrypt/... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int n,a,b;
printf("\n********CHOICES********\n");
printf("1.) Addition\n");
printf("2.) Substraction\n");
printf("3.) Multiplication\n");
printf("4.) Division\n");
printf("Enter your choice: ");
scanf("%d",&n);
switch(n)
{
case 1: printf("Enter ... |
C |
#include <stdio.h>
#include "instruction.h"
#include "helper_procedures.h"
#include "register.h"
#include "thumb_add_sub_cmp_mov_imm8.h"
void thumb_add_sub_cmp_mov_imm8(short ins)
{
func p;
*((short *)&DataAddSubCmpMovImm8)=ins;
p=(func)data_add_sub_cmp_mov_imm8_process[(int)DataAddSubCmpMovImm8.opc];
(p)(ins)... |
C | #include "lists.h"
/**
* pop_listint - function that deletes the head node of a listint_t linked list
* @head: double pointer
* Return: returns the head node's data (n) if the linked
* list is empty return 0
*/
int pop_listint(listint_t **head)
{
listint_t *temp = NULL;
int count = 0;
if (*head == NULL)
{
... |
C | #include "libft.h"
int ft_strclen(char *str, char c)
{
int i;
i = 0;
while(str[i] && str[i] != c)
i++;
return (i);
}
|
C | #include "myLib.h"
void myFunc (int * array1, int * array2, int * array3, int N)
{
int i;
for(i=0;i<N;i++)
array3[i] = array1[i] + array2[i];
}
int main (int argc, char ** argv)
{
assert(argv[1]!=NULL);
int N = atoi (argv[1]);
assert(N>=1);
assert(argv[2]!=NULL);
int I = atoi (argv[2]);
assert(I>=1);
p... |
C | //
// main.c
// 2-60c
//
// Created by Bin Li on 1/19/17.
// Copyright © 2017 Bin Li. All rights reserved.
//
#include <stdio.h>
unsigned replace_byte (unsigned x, int i, unsigned char b);
int main(){
//printf("%u", replace_byte(0x12345678, 2, 0xAB));
int a = 0xAB;
printf("%x/n", a << 8);
}
unsign... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h> // write,close
#include <sys/stat.h> // fifo
#include <fcntl.h> // O_WRONLY
int main() {
int ret = -1;
char *fifo = "./fifo";
// Just write to FIFO, no need to create FIFO
char *msg = "This is message";
int fd = open(fifo, O_WRONLY);... |
C | /***************************************************************************
* File: main.c
* Author: Toby
* Modification History:
* Toby - 4 October 2020
* Procedures:
* main - main function that will call the necessary amount of producers and consumers, and simulate the 'market'
* consumer - Creatse a consumer tha... |
C | #include<stdio.h>
int main()
{
int c=1,n,SOP[22] ={0,1, 1, 1, 3, 8, 21, 43, 69, 102, 145,197, 261, 336, 425, 527, 645, 778, 929, 1097, 1285,1492};
while(scanf("%d",&n)==1 &&n)
printf("Case #%d: %d\n",c++,SOP[n]);
return 0;
}
|
C | #include <stdio.h>
int main(void) {
int a[100];
int n;//so luong phan tu cua mang
do{
printf("\nnhap n = ");
scanf("%d", &n);
}while( n <= 0 || n > 100);
for(int i = 0; i < n; i++){
printf("\nnhap a[%d] = ",i);
scanf("%d", &a[i]);
}
for(int i = 0;i < n;i++){
printf("a[%d] = %d\n",i,a[i]... |
C | #include "BandpassFilter.h"
float BandpassFilter_init(BandpassFilter_t* filter, float lk, float hk){
filter->highPassK = hk;
filter->lowPassK = lk;
filter->lowPassVal = 0;
filter->highPassVal = 0;
}
float BandpassFilter_update(BandpassFilter_t* filter, float in){
filter->lowPassVal = filter->lowPassVal + filt... |
C | /*
============================================================================
Name : median.c
Author : shinu shaji,stebin yohannan
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
===========================================================================... |
C | //triangulo.c
#include <stdio.h>
#define base 10 * 1 //equilatero
#define altura (base/2) * 1
void triangulo(char caracter){
int i, j;
int restar = altura, espacios = 0;
while(restar > 0){
for(i = 0; i < restar; i++)
printf(" ");
restar--;
printf("%c", caracter);
if(espacios > 0... |
C | /* cs194-24 Lab 1 */
#include <stdbool.h>
#include <string.h>
#include <sys/epoll.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/sysinfo.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <errno.h>
#include "http.h"
#include "mimetype.h"
#include "palloc.h"
#include "cache.h"
#define PORT 8088
#d... |
C | /* demonstration of unions */
#include<stdio.h>
#include<string.h>
union car
{
char name[25];
int price;
};
int main(int argc, char const *argv[])
{
union car c1;
strcpy(c1.name, "GTX");
c1.price = 98000; // retains only the latest declrared value
printf("\n\n%s \t %d\n\n", c1.name, c1.p... |
C | #include<stdio.h>
int fib(int n)
{
if(n<=1)
{
return n;
}
return fib(n+1)+fib(n+2);
}
int main()
{
int n;
scanf("%d",&n);
fi=fib(n);
printf("%d",fi);
}
Input:
6
Output:
8
|
C | #include "holberton.h"
/**
* _strspn - get leng.
* @s: string 1.
* @accept: for scan in the s.
* Return: Always 0.
*/
unsigned int _strspn(char *s, char *accept)
{
int rec, comp, sum;
sum = 0;
rec = 0;
while (s[rec] != ',')
{
comp = 0;
while (accept[comp] != '\0')
{
if (s[rec] == accept[comp])
... |
C | #include <stdio.h>
int main() {
/* Escribe los numeros del 1 al 10 */
int numero, suma, impares;
float promedio;
suma = 0;
for (numero=0;numero < 10;numero++)
{
if (numero % 2 != 0)
{
printf("%d\n",numero);
impares++;
}
suma = suma + numero;
}
promedio = suma / numero;
printf ("Co... |
C | #include <pthread.h>
#include "buffer.h"
static buffer_t buffer[BUFSIZE];
static pthread_mutex_t bufferlock = PTHREAD_MUTEX_INITIALIZER;
static int bufin = 0;
static int bufout = 0;
int getitem(buffer_t *itemp) { /* remove item from buffer and put in *itemp */
int error;
if (error = pthread_mutex_lock(&bufferl... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
float x;
scanf("%f", &x); //輸入攝氏溫度
printf("%.2f\n", x * 9 / 5 + 32); //印出華氏溫度
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "rthread.h"
#define WHISTLER 0
#define LISTENER 1
struct device {
/* These three semaphores should always sum to 1.
*/
rthread_sema_t mutex;
rthread_sema_t whistlerSema;
rthread_sema_t listenerSe... |
C | //
// Calculator.c
// PostfixCalculator
//
// Created by 이동영 on 10/09/2019.
// Copyright © 2019 부엉이. All rights reserved.
//
#include "Calculator.h"
#include "string.h"
#include "Stack.h"
double calculate(char* postfixExpression) {
long length = strlen(postfixExpression);
int i = 0;
Stack *operand = c... |
C | /*
* El programa crea un vector int de n números dados por el usuario
* utilizando memoria dinámica.
*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
// *p -> puntero
// n ... |
C | #include <stdio.h>
#define VERSION "1.0.0"
void print_version()
{
char ver[]=VERSION;
printf(" Version %s \n", ver);
}
|
C | #include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include "inodeinc.h"
extern int init(char *disk);
extern int getInodesPerGroup();
extern int getBlockSize();
extern int getInodeSize();
void readInode(int inode, FILE *fp)
{
printf("----- BEGIN INODE READING -----\n");
struct ext3_inode ... |
C | /*
* Copyright (c) 2019 Team 3555
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, ... |
C | #include <stdio.h>
/*
* Faça um método recursivo que retorne a sequência de fibonacci.
*/
int fib(int n){
int resp;
if(n == 0 || n == 1 || n == 2)
resp = 1;
else
resp = fib(n - 1) + fib(n - 2);
return resp;
}
int main(){
int n;
printf("Digite qual termo da série de Fibona... |
C | #define _GNU_SOURCE
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/wait.h>
#include <unistd.h>
/* keep special_exit_code in sync with container_top_linux.go */
int special_exit_code = 255;
char **argv = NULL;
void
create_argv (int len)
{
/* allocate one extra element ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.