language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /**
* @file encode.h
* @brief Encode raw frames to video.
* @author Ryan Jacobs <ryan.mjacobs@gmail.com>
* @date March 18, 2015
* @bug No known bugs.
*/
#ifndef ENCODE_H
#define ENCODE_H
/**
* Main encode loop.
* Captures RGB frames and writes them to an h264 stream.
*
* @param filename Outpu... |
C | /*
Note: compile with the Makefile
Note: correct output example
./eB4 /u1/junk/shakespeare.txt
Number of words with ...
1 letter: 20
2-5 letters: 5916
20-100 letters: 12
./eB4 /u1/junk/kinne/shakespeare_1000_lines.txt
Number of words with ...
1 letter: 6
2-5 letters: 785
20-100 letters: 0
Recal... |
C | #include<stdio.h>
void main(void)
{
int arr1[3] = {1, 2, 3};
for(int i = 0; i<3; i++)
{
*(arr1+i) += 100*(i+1);
}
for(int i = 0; i<3; i++)
{
printf("%d ", arr1[i]);
}
} |
C | #include<stdio.h>
#include<conio.h>
float PU,MB,MHT,Taxe,TVA,MTTC,Red;
int Q;
void main ()
{
printf("Donnez le prix unitaire\n");
scanf("%f",&PU);
printf("Donnez la quantite\n");
scanf("%d",&Q);
MB=Q*PU;
printf("Le montant brut est MB=%.2f\n",MB);
if(Q<20)
Red=0;
else
{
... |
C | /*
created by li Danny
Date:/ 2015/12/20
*/
#include "DSP2833x_Device.h"
#include "DSP2833x_Examples.h" // DSP2833x Examples Include File
#include "math.h"
#include "DATA_Process.h"
#include "ConstData_Table.h"
#include "AD7656.h"
#include "std_init.h"
// Global variable for this example
//3·ͨԾĽ
fl... |
C | %{
#include "tabsimb2.c"
#include <stdlib.h>
#include <stdio.h>
simbolo * t;
%}
%union {
int numero;
simbolo * ptr_simbolo;
}
%token <numero> NUMERO
%token <ptr_simbolo> ID
%token ASIG
%type <numero> expr asig prog
%left '+'
%left '*'
%%
prog : prog asig '\n' { printf("Asignaciones efectuadas\n");}
|... |
C | #include <stdio.h>
//sort arr in incresing order
// n is the number of elements in arr
void sort_recur(int *arr, int n)
{
if (n == 0)
return;
int min = 10000;
int pos = 0;
for (int i = 0; i < n; i++)
if (arr[i] < min)
{
pos = i;
min = arr[i];
}
... |
C | /*******************
*
* $Date:$
* $Revision:$
* $Author:$
* $HeadUrl:$
* $Id: mvvonmises.c 13 2015-04-17 08:17:47Z lrodriguez $
**/
#include <stdlib.h>
#include <stdint.h>
#include <math.h>
#include <float.h>
#include <stdint.h>
#include <string.h>
#include "bessel.h"
#include "mvvonmises_likelihood.h"
#includ... |
C | #include "common.h"
void next_step() {
int i, j;
int best_i=-1, best_j=-1, best=INFINITE;
for(i=0;i<KORIFES;i++) {
//An i korifi einai sto sinolo V, tote elegxoume ton pinaka geitniasis
if(vertices[i]) {
for(j=0;j<KORIFES;j++) {
//An i akmi (i,j) iparxei idi sto sinolo E, tote sinexizoume
if(v... |
C | /*
50 ֪ѧļ¼ѧźѧϰɼɣ
nѧѴaṹС
дfunúĹǣҳɼߵѧ¼ͨβη(涨ֻһ߷)
*/
#define N 10
struct student
{
int id;
float score;
};
struct student s[N];
struct student fun(struct student s[],int n)
{
int max = 0;
struct student temp;
for (int i = 0; i < n; i++)
{
if (s[i].score > max)
max = s[i].score;
tem... |
C | #pragma once
#define PI 3.1415926535897932384626433832795
#define PI_DEG 180
#define PI_DEGx2 360
struct Point {
float x = 0;
float y = 0;
Point() {}
Point(float x, float y)
: x(x), y(y){}
bool operator==(const Point& point);
};
struct Line {
float k = 0;
float c = 0;
Line() {}
float f(float x);
};
... |
C |
#include <stdlib.h>
#include "lists.h"
/**
* delete_dnodeint_at_index -deletes node at index of a dlistint_t linked list.
* @head: the head of list.
* @index: the index.
* Return: 1 or -1.
*/
int delete_dnodeint_at_index(dlistint_t **head, unsigned int index)
{
unsigned int i = 0, c = 0;
dlistint_t *curr = *hea... |
C | #include "sort.h"
/**
*
*
*
*
*/
void selection_sort(int *arr, size_t size)
{
int saved, swap, state;
size_t i, j, index;
state = 0;
for (i = 0; i < size; i++) {
for (j = i + 1; j < size; j++) {
if (state == 0 && arr[i] > arr[j]) {
saved = arr[j];
index = j;
state = 1;
}
else if (state ... |
C | #include "privparent.h"
#include "privsock.h"
#include "sysutil.h"
#include "tunable.h"
static void privop_pasv_get_data_sock(session_t *sess);
static void privop_pasv_active(session_t *sess);
static void privop_pasv_listen(session_t *sess);
static void privop_pasv_accept(session_t *sess);
//ڼͷļDZʱimplicit declarati... |
C | #include <stdio.h>
#include <math.h>
int main()
{
float r1, r2, x1, x2, y1, y2, s = 0, a, b;
int ymax, ymin, xmax, rmax, rmin, xmin;
printf("Vvedite koordinats x, y b radius pervoy okruzhosti");
scanf("%f %f %f", &x1, &y1, &r1);
printf("Vvedite koordinats x, y b radius vtoroy okruzhosti");
scanf("%f %f %f", &x2, ... |
C | #include "matrixMul8.h"
typedef signed char Filtc;
typedef signed char FiltcV __attribute__((vector_size (4)));
#define SumDotp(a, b, c) __builtin_pulp_sdotsp4(a, b, c)
#define Dotp(a, b) __builtin_pulp_dotsp4(a, b)
void __attribute__ ((noinline)) matMul8(signed char * __restrict__ A, signed char * __rest... |
C | #include "priority.h"
#include "../tasks.h"
void init_scheduler(struct process* list, int size, int ramend) {
int i;
for(i=0; i < size; i++) {
list[i].stack_size = 100;
list[i].running = 0;
}
list[0].task_pointer = task0;
list[1].task_pointer = task1;
list[2].task_pointer = ta... |
C | #include <stdio.h>
#define SIZE 128 /* ascii */
/* print a histogram of different characters in its input */
int main() {
int c, i, j;
count = 0; /* 单词长度计数器 */
int nlen[SIZE]; /* 统计SIZE个字符长度的单词的直方图,超过SIZE,按ZIE-1算 */
max = 0; /* 追踪长的单词 */
for(i = 0; i < SIZE; ++i)
nlen[i] = 0;
while(... |
C | #include "generic.h"
#include <stdlib.h>
void Generic_Delete(Generic *G){
free(*G);
*G = NULL;
}
void Generic_Interchange(Generic *G, Generic *G2){
Generic tmp;
tmp = *G;
*G = *G2;
*G2 = tmp;
}
|
C |
#include<stdio.h>
#include<mpi.h>
#include<string.h>
#define BUFFER_SIZE 32
// MPI data type: MPI_INT, MPI_CHAR
// MPI_Send(value or massage to be send, size of message,data type od message, recever rank id, uniqu tage ,MPI_COMM_WORLD);
// MPI_Recv(recevung message, size of reseving message,data type ,sender rank... |
C | /*
* Python interface to libc functions.
*/
#include <stdarg.h> // va_list, etc.
#include <stdio.h> // printf
#include <limits.h>
#include <stdlib.h>
// Enable GNU extensions in fnmatch.h.
// TODO: Need a configure option for this.
#define _GNU_SOURCE 1
#include <fnmatch.h>
#include <glob.h>
#ifdef __FreeBSD__
#... |
C | #include "sparsemat.h"
#include <stdio.h>
#include <stdlib.h>
/* This program implements linked lists to represent sparse matrices given in text files, sorting them in row major order, as well as interfacing with them in other ways such as removing nodes, or adding nodes in the proper locations. There are also functi... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "Assembler.h"
extern int startIndexForTextPart;
extern int endIndexForTextPart;
extern char rawCodeLines[100][100];
extern int currentInstLine;
extern int currentTextLine;
extern struct _Label arrOfLabels[100];
extern ... |
C | #include <stdio.h>
#include <string.h>
#include <mpi.h>
const int MESSAGE_SIZE = 100;
int main(int argc, char ** argv) {
char message[MESSAGE_SIZE];
int processes, id;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &processes);
MPI_Comm_rank(MPI_COMM_WORLD, &id);
if (id != 0) {
... |
C | // little virtual machine
int acc1;
int acc2;
acc1 = 0;
acc2 = 0;
void dispatch (int instr){
switch (instr){
case 0:
acc1 = 0;
acc2 = 0;
break;
case 1:
acc1++;
break;
case 2:
acc2++;
break;
case 3:
acc2 = acc1;
break;
case 4:
acc1 = acc1 + acc2;
break;
}
}
dis... |
C | #include <stdio.h>
#include "include/wd.h"
int main()
{
char *name = "name a";
name = wd_get_accel_name(NULL, 0);
printf("a name = %p\n", name);
name = "name b";
name = wd_get_accel_name("/dev/hisi_zip-0", -1);
printf("b name = %p\n", name);
name = "name c";
name = wd_get_accel_name("/dev/hisi_zip-0", 2);
... |
C | /* ================================================
* IST LEIC-T Analise e Sintese de Algoritmos 18/19
* Project 2 - proj2.c
*
* Authors:
* Manuel Mascarenhas - 90751
* Miguel Levezinho - 90756
* ================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#... |
C | /*
** EPITECH PROJECT, 2019
** CPE_matchstick_2018
** File description:
** matchstick_main
*/
#include "my.h"
char **remove_matches_ai(char **map, struct a_intelligence *ai, int i)
{
while (ai->matches > 0) {
i--;
map[ai->line][i] = ' ';
ai->matches--;
}
return (map);
}
char **rem... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "utf8.h"
#define FILE_NAME "Blocks.txt"
#define LINE_SIZE 10000
#define UTF8_SIZE 7
#define NAME_SIZE 50
typedef struct {
long count;
char begin[UTF8_SIZE];
int begin_d;
char end [UTF8_SIZE];
int end_d;
char name [NAME_SIZE]... |
C | #include "graph_funcs.h"
/** Computes the number of neighbors in each part
* @param i - vertex for which we compute
* @param part - pointer to the first part
* @param other_part - pointer to the second part
* @param neigh_part - pointer to the number of neighbours in the first part
* @param neigh_other_part - po... |
C | void f(int n){
if(n==0) printf("zero");
else if(n>0) printf("positive");
else if(n<0) printf("negative");
} |
C | /* Write a loop equivalent to this that doens't use && or || */
#include <stdio.h>
int main()
{
int lim = 5;
int c;
printf("BEFORE:\n");
for (int i = 0; i < lim - 1 && (c = getchar()) != '\n' && c != EOF; ++i)
putchar(c);
printf("\n\n\nAFTER:\n");
int i = 0;
while (1) {
i... |
C | #include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
float change = get_float("Cash owed: ");
while (change < 0) //only accept positive values
{
change = get_float("Cash owed: ");
}
int pennies = round(change * 100); //convert to pennies and from float to int
int tot... |
C | /*
*a tyne user app: a->b b->c ...z->a
*used to show tty mode
* */
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main(){
int c;
while( (c = getchar()) != EOF){
if(c == 'z') c = 'a';
else if( islower(c)) c++;
putchar(c);
}
return 0;
}
|
C | #include <stdio.h>
#include <string.h>
#include <malloc.h>
// Sprite Rotation
void GUGSpriteRotate90(char *sprite) {
int sz,sx,sy,x,y,y1;
char *spr_save; // [1028];
sx = GUGSpriteWidth(sprite);
sy = GUGSpriteHeight(sprite);
sz = GUGSpriteSize(sprite);
if ((spr_save = malloc(sz)) == NULL)
return;
... |
C | #include <stdio.h>
#include <stdlib.h>
struct DEqueue
{
int size;
int front;
int rear;
int *arr;
};
int isEmpty(struct DEqueue *q)
{
if (q->front == q->rear)
{
return 1;
}
else
{
return 0;
}
}
int isFull(struct DEqueue *q)
{
if (q->front == -1 && q->rear ==... |
C | //Poligonal: Série de segmentos de retas conectados
//Perimetro é a soma de todos os lados da poligonal
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
typedef struct {
double northing;
double easting;
} coord;
typedef struct {
coord v1,v2,v3;
} Triangulo... |
C | #include <stdio.h>
void pf(void);
int main(void)
{
for(int i=1; i <=3;i++)
{
pf();
}
return 0;
}
void pf(void)
{
static int i = 1;
int y =1;
printf("%d %d \n", i++, y++);
}
|
C | /***************************************************************************//**
@file +Nombre del archivo (ej: template.h)+
@brief +Descripcion del archivo+
@author +Nombre del autor (ej: Salvador Allende)+
******************************************************************************/
#ifndef _FSM_H_... |
C | #include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <unistd.h>
#include <ctype.h>
#include <openssl/sha.h>
#include <errno.h>
#include <math.h>
#include <fcntl.h>
#include <sys/param.h>
#include <regex.h>
#include <archive.h>
#include <archive_entry.h>
#include <... |
C | /*******************************************************************//**
*
* \file Gfx.c
*
* \author Xavier Del Campo
*
* \brief Implementation of Gfx module.
*
************************************************************************/
/* *************************************
* Includes
* *******************... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int x;
for (int x = 10; x>0; x--)
{
printf("%d\n",x );
}
return 0;
} |
C | #include "PlotHandler.h"
/***************************************************************************
* Name :PlotHandler.c
* Author :Sai
* Date :07/15/99
* Purpose :setupPlotHandler: Sets up the array of the plothandler. The
* celltypes that correspond to the subset are stored in cellIndic... |
C | #include<stdio.h>
#include<string.h>
struct student
{
int m[100];
char name[100];
float avg;
int rank;
};
int input(struct student stu[],int i,int m)
{
int k,flag=0;
printf("Enter the student name :");
scanf("%s",&stu[i].name);
for(k=0;k<m;k++)
{
printf("Enter the Subject %d marks :",k+1);
scanf("%d",&stu[... |
C | /*
#Author : kiran raj r
#Language : C
#Topic : Array
#Date : 02/12/2020
*/
#include <stdlib.h>
#include <stdio.h>
void main() {
int array1[] = {22,12,23,44,55};
printf("First element %d \n", array1[0]);
printf("Last element %d \n", array1[4]);
array1[0] = 100;
array1[4] = 1000;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* history_write.c :+: :+: :+: ... |
C | #include "llist.h"
struct ListNode *ll_create_node(void *data) {
struct ListNode *node = (struct ListNode *)malloc(sizeof(struct ListNode));
node->next = NULL;
node->data = data;
return node;
}
/* Inserts a new node after the one provided */
void ll_insert(struct ListNode *prev_node, void *data) {
... |
C | #include <stdio.h>
int main(void)
{
const int ROWS = 6;
const int CHARS = 6;
int row;
char ch;
for(row = 0;row<ROWS;row++)
{
for(ch=('A'+row);ch<('A'+CHARS);ch++)
printf("%c",ch);
printf("\n");
}
return 0;
}
|
C | /*
* base.cpp
* function????
* Created on: 2012-11-28
* Author: sear
*/
int main() {
int a, b, c; //a,b,c???????????1?2?3
int i, j, k; //i,j,k????abc??
for (a = 1; a < 4; a++) //a,b,c??1?3??
for (b = 1; b < 4; b++) {
if (a == b)
continue; //a=b?b???1
for (c = 1; c < 4; c+... |
C | /* cbregister.c - cbregister */
#include <xinu.h>
/*---------------------------------------------------
* cbregister - callback function
*---------------------------------------------------
*/
syscall cbregister(
void (* fp)(void), /* a function pointer to a user callback */
umsg32 *mbufptr /* a pointe... |
C | /* Program: small-db-2.c */
#include <stdio.h>
#include <strings.h>
#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
#include <limits.h>
// =====================
// = Type declarations =
// =====================
// The Column Value union. Stores either an integer, a
// double or 8 (7 + 1) characters.
typed... |
C | main()
{
int i,arr[25],prsnt=0,num;
printf("Please enter 25 numbers: \n");
for(i=0;i<25;i++)
{
scanf("%d",&arr[i]);
}
printf("\n\nPlease enter the number to be searched: ");
scanf("%d",&num);
for(i=0;i<25;i++)
{
if(num==arr[i])
prsnt=prsnt+1;
}
if(prsnt==0)
{
printf("\n\nNumber does not present in the ... |
C | #include "binary_trees.h"
/**
* binary_tree_size - Function that measures the size of a binary tree
* @tree: Pointer to the root node of the tree to measure the size.
*
* Return: return the sum of the the two branches.
*/
size_t binary_tree_size(const binary_tree_t *tree)
{
size_t left = 0;
size_t right = 0;
... |
C | #define SIZE 10
void size(int arr[SIZE])
{
printf("size of array is:%d\n",sizeof(arr));
}
int main()
{
int arr[SIZE];
//its doesnt work cause the param in size is a pointer
size(arr);
printf("%d\n", sizeof(arr) );
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#define livre 1
#define parede 2
#define visitada 3
#define beco 4
#define saida 5
#define max 30
#define ANSI_COLOR_RED "\x1b[31m"
#define ANSI_COLOR_YELLOW "\x1b[33m"
#define ANSI_COLOR_BLUE "\x1b[34m"
#define ANSI_COLOR_RESET "\x... |
C | //Program 37: Print the 8th pattern
#include <stdio.h>
void main()
{
int i,j,x;
for(i=1;i<=4;i++)
{
x=i;
for(j=1;j<=i;j++)
{
int p=(x%2==0)?0:1;
printf("%d",p);
x++;
}
printf("\n");
}
}
/*
Output:
1
01
101
0101
*/
|
C | #include<stdio.h>
void swap(int *a,int *b);
int main()
{
int a,b;
scanf("%d %d",&a,&b);
swap(&a,&b);
printf("%d %d\n",a,b);
return 0;
}
void swap(int *a,int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
|
C | #include <stdio.h>
/*
The program prints the Floyd's triangle
for a given row size.
*/
int main()
{
int size;
int number = 1;
printf("Please enter a row size\n> ");
scanf("%d", &size);
printf("\n");
for (int row = 1; row <= size; row++)
{
for (int i = 1; i <= row; i++)
{
printf("%d ", number);
n... |
C | #include "Assignment_1_headder.h"
struct dll {
int info;
struct dll *dll_llink;
struct dll *dll_rlink;
};
struct dll *dll_start = NULL;
struct dll *dll_temp = NULL;
struct dll *dll_p = NULL;
int dll_count = 0;
int double_linked(void)
{
int ch;
do {
printf("\n*************Double Linked List**************\... |
C |
#include <stdio.h>
#include <stdlib.h>
/**
* constant to represent infinity
* it is assumed that no edge in the vertex will have weight equal
* to this value.
*/
#define INF 9999
/**
* total number of vertices in the graph
*/
#define V 9 //nodes number
/**
* this function will r... |
C | /* getline.c -- Replacement for GNU C library function getline
Copyright (C) 1993, 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either versio... |
C | /* This program builds a large database and tests the time required for various
* operations
*/
#include <stdio.h>
#include <stdlib.h>
#include <gdbm.h>
#include <time.h>
#define SIZE 1000000
// A function for timing functions
int time_function(GDBM_FILE db, void(*fun)(GDBM_FILE)){
clock_t start;
clock_t s... |
C | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "cards.h"
void assert_card_valid(card_t c) {
assert (c.value>=2 && c.value<=VALUE_ACE);
assert (c.suit>=SPADES && c.suit<=CLUBS);
}
const char * ranking_to_string(hand_ranking_t r) {
switch (r) {
case STRAIGHT_FLUSH: return "STRAIGHT_FLUSH... |
C | /***
*vsprintf.c - print formatted data into a string from var arg list
*
* Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines vsprintf() and _vsnprintf() - print formatted output to
* a string, get the data from an argument ptr instead of explicit
* ... |
C | #include <stdio.h>
void func1(void);
void func2(void);
void func1(void)
{
int a = 520;
printf("value of a is %d\n", a);
printf("addr of a is %p\n", &a);
}
void func2(void)
{
int b = 880;
printf("value of b is %d\n", b);
printf("addr of b is %p\n", &b);
}
int main(void)
{
func1();
func2();
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#define inf 999
int main()
{
int m,n,min,i,j,book[10]={0},d[10],e[10][10],t1,t2,t3,s=0,sum=0;
//ȷͱ
printf("붥Լ:Ҫ9\n");
scanf("%d%d",&m,&n);
//ʼ
for(i=1;i<=m;i++)
for(j=1;j<=m;j++)
if(i==j)
e[i][j]=0;
else
... |
C | // (c) 2020 shdown
// This code is licensed under MIT license (see LICENSE.MIT for details)
#include "lexer.h"
#include "ht.h"
#include "hash.h"
enum {
BLOCKY_BIT = 1 << 10,
};
enum {
LEVEL_EXPR,
LEVEL_STMT,
};
typedef struct {
char *data;
size_t size;
size_t capacity;
size_t blocky_le... |
C | #include "native.h"
#include "vm.h"
#include "comet.h"
#include <string.h>
#include <stdio.h>
void defineNativeFunction(VM *vm, const char *name, NativeFn function)
{
push(vm, OBJ_VAL(newNativeFunction(vm, function)));
push(vm, copyString(vm, name, (int)strlen(name)));
addGlobal(peek(vm, 0), peek(vm, 1));... |
C | #include <stdio.h>
#include <string.h>
#include "../util.h"
char *
get_engine(void)
{
FILE *pf;
char command[20];
char data[512];
char *engine;
sprintf(command, "ibus engine");
pf = popen(command, "r");
fgets(data, 512, pf);
data[strlen(data) - 1] = '\0';
if (pclose(pf) != 0)
{
engine = (char *)bprintf... |
C | #include "LPC17xx.h"
#include "stdio.h"
#define NUM 198
// EE2024 Assignment 1 skeleton code
// (C) CK Tham, ECE, NUS, 2018
// Do not modify the following function prototype
extern int asm_stats(int* px, int* pvar, int* pmin, int* pmax);
typedef struct data
{
int x[NUM];
int mean;
int variance;
int min;
in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
//void inti(struct stack *);//initialize stack members
//void push(struct stack *, int);//grow contents to store int
//int pop(struct stack *); //shrink contents and return top int
struct node{
int val; //integer node value
struct node *next; //pointer to ... |
C | /**
* @file adc.h
* @brief ADC - Analog-to-Digital Converter
* @details This API is used to read values from the ADC-channels.
* @pre Initiate board and enable peripheral clock for ADC.
*
* Important: Not all functionality of the ADC is implemented in this API yet.
*
* @author Hisham Ramish
* @author Mattias N... |
C | #include "types.h"
#include "stat.h"
#include "user.h"
int x = 0;
int thread_func(void *arg)
{
int id = (int) arg;
printf("Hello from thread %d\n", arg);
x = 99;
thread_exit(0);
}
int main(int argc, char **argv)
{
void *m;
void *stack;
struct thread t;
int rv;
stack = malloc(4096);
printf("x =... |
C | /* ַ */
#include<stdlib.h>
main()
{
int i,j;
char a[][5]={{'B','a','s','i','c'},{'D','b','a','s','e'}};
for(i=0;i<=1;i++)
{
for(j=0;j<=4;j++)
printf("%c",a[i][j]);
printf("\n");
}
getch();
}
|
C |
/*
The module game contain the board that we are playing on and the solution of this
borad. The module is used to manipulate the game status, validate, set, restart,
exit game, printing sudoku board ect.
The game takes place in this module.
*/
#ifndef GAME_H_
#define GAME_H_
#include<stdbool.h>
/*mode: 1 - solve comm... |
C | /*
* Programming Assignment #1_2
* ۼ : 20160074 ȭаа
* ۼ : 160929
*/
#include <stdio.h>
#include <math.h>
int main()
{
//
int x1, x2, x3, y1, y2, y3;
double S, s, l12, l13, l23;
//ǥ Է
printf("Enter P1 (x1, y1) : ");
scanf("%d%d", &x1, &y1);
printf("Enter P2 (x2, y2) : ");
scanf("%d%d", &x2, &y2);
printf("En... |
C | #include <stdio.h>
#include <stdlib.h>
int foo(int tab[][100], int unsigned n)
{
int wynik = 0;
for(int i=0; i<n; i++)
{
for(int j=0; j<100; j++)
{
tab[i][j] = rand() % 100+1;
wynik += tab[i][j];
}
}
return wynik;
}
int main()
{
... |
C | #include <git2.h>
#include <stdio.h>
#include <string.h>
#include "common.h"
int parse_pkt_line(git_repository *repo, int argc, char **argv)
{
char *line = argv[1];
char oid[GIT_OID_HEXSZ+1] = {0};
const char *after = line;
int error;
unsigned int len;
git_pkt *pkt;
/*
* Assume that the user has pipe... |
C | #include "main.h"
#include "malloc_safe.h"
#include "iface_usart.h"
#include "utils/timebase.h"
#include "utils/circbuf.h"
#include "com/com_fileio.h"
#include "com/debug.h"
#include "bus/event_queue.h"
#define DEF_WAIT_TO_MS 5
typedef struct {
uint16_t wait_timeout;
USART_TypeDef *dev;
CircBuf *rxbuf; // al... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* dump_memory.c :+: :+: :+: ... |
C | #include <stdio.h>
//Following function will sort the array in Increasing (ascending) order
void bubble_sort(int arr[], int n)
{
int i, j, tmp;
for(i = 0; i < n-1; i++)
{
// Last i elements are already in place, so the inner loops will run until it reaches the last i elements
for(j = 0; j <... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lltoa.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "ws_6.c"
int main()
{
unsigned int arr[8] = {1,7,100000,4,5,146,13};
int a= 3;
int b= 5;
int *p_a = &a;
int *p_b = &b;
float num = -118.625;
printf("pow2: work %f \n", Pow2(5,0));
printf("pow2: work %f \n", Pow2(5,-1));
/*if(Pow2(5,0) != 5)
{
printf("pow2: error1 \n");
... |
C | #include "data_structure.h"
#include "error.h"
STACK_S* BASE_CreateStack(INT iStackSize)
{
STACK_S* pstStack = NULL_PTR;
if (iStackSize > iStackSize)
{
return ERROR_GENERAL_ERROR;
}
pstStack = (STACK_S*)BASE_Malloc(sizeof(STACK_S));
if (pstStack == NULL_PTR)
{
return ERROR... |
C |
void insertionSort (int* vector, int size) {
int i, j, key;
for (j = 1; j < size; j++) {
key = vector[j];
i = j - 1;
while (i >= 0 && vector[i] > key) {
vector[i + 1] = vector[i];
i = i - 1;
}
vector[i+1] = key;
}
}
|
C | /*---------------------------------------------------------------------------------------
MaxEle.c
Program to find the maximum element in a matrix
DIVYA RAJ.K
12-10-18
-----------------------------------------------------------------------------------------*/
#include<stdio.h>
main()
{
int X[20][20],M,N,i,j,Max,Row=1,... |
C | /* Test case by Paul Eggert <eggert@twinsun.com> */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdint.h>
struct big {
char *c;
uint32_t cnt;
};
struct big *array;
int compare (void const *a1, void const *b1)
{
struct big const *a = a1;
struct big const *b = b1;
... |
C | #include "board.h"
#include "retrociaa/m4/base/systick.h"
#include "retrociaa/m4/base/mempool.h"
#include "retrociaa/m4/base/semaphore.h"
#include "retrociaa/m4/os/api.h"
#include "retrociaa/m4/os/mutex.h"
#include "appdata.h"
OS_TaskRetVal taskInput (OS_TaskParam arg)
{
struct AppData *ad = (struct AppData *... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int get_bit(const uint32_t, const uint32_t);
/*
* Problem 01.b. Bitwise: Extract Bit #3
*
* Using bitwise operators, write an expression for finding the value of the
* bit #3 of a given unsigned integer. The bits are counted from right to left,
* star... |
C | #include <stdio.h>
#include <stdlib.h>
#include "queue.h"
#define QUEUE_SIZE 100
struct queue_type {
int contents[QUEUE_SIZE];
int first;
int last;
int num_elements;
};
static void terminate(const char *message) {
printf("%s\n", message);
exit(EXIT_FAILURE);
}
Queue create(void) {
Queue ... |
C | #include <stdio.h>
#include <math.h>
unsigned set_n(unsigned x, int pos, int n)
{
//需要设为1的个数 ^(0<<n)
//需要从第几位开始 (^(0<<n)) << pos
unsigned j = 0;
for (int i = 0; i < n; i++) {//从第0位到第(n-1)位均为1
j += pow(2, i);
}
return x | (j << pos);
}
unsigned reset_n(unsigned x, int pos, int n)
{
unsigned j = 0;
for (in... |
C | /* ===========================================================
#File: win32_fileio.c #
#Date: 16 March 2021 #
#Revision: 1.0 #
#Creator: Omid Miresmaeili #
#Description: copying file with win32 fileio vs c stdio #
#Notice: (C) Copyright 2021 by Omid. All Rights Reserved. #
========================... |
C | /* Gary Williams
* COMPE 375-01
* Lab 4 Due: 2/24/17
*
* Overview:
* For this laboratory assignment we were required to transmit the characters of our RedID
* through the USART port on the ATmega328PB. We were also required us to set the baud rate
* to 9600 and to set the data packet length to ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strrchr.c :+: :+: :+: ... |
C | #include <stdio.h>
#define NUMER0_DE_TENTATIVAS 5
int main() {
printf("\n");
printf("\n");
printf("######################################\n");
printf("## Bem vindo ao jogo de adivinhação ##\n");
printf("######################################\n");
printf("\n");
printf("\n");
int numero_... |
C | #include "adc.h"
void adc_config(){
ADCON0 = 0x28; //AN10 channel only
ADCON1 = 0xC6; //result right justified, Fosc/4 source (1.33 us Tad), VREFs
__delay_ms(2); //general aquisition time for channel selection
}
uint16_t adc_read(){
ADCON0bits.ADON = 1; //ADC on
ADCON0bits.GO_nDONE = 1; ... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i,j,h,c,Dig;
char Tel[10];
char Parte1[4];
char Parte2[4];
Dig = 0;
printf("Digite seu telefone: \n");
gets(Tel);
for(i=0; Tel[i] != '\0'; i++){
Dig++;
if(Tel[i] == '-'){
Dig--;
}
}... |
C | // Created by Ameer Ali
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_attr.h"
#include "driver/mcpwm.h"
#include "soc/mcpwm_reg.h"
#include "soc/mcpwm_struct.h"
#define SERVO_MIN_PULSEWIDTH 780 //Minimum pulse width in microsecond
#define SERVO_MAX_PULSEWIDTH 2190 //Maxi... |
C | #include <stdio.h>
int main()
{
int n = 6, i, factor, sum=0;
for(i =1; i < n ; i++)
{
if(n % i ==0)
{
sum = sum + i;
}
}
if(n == sum)
printf("%d is perfect number\n", n);
else
printf("%d is not perfect number\n", n);
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include "ifindex.h"
#define red "\033[0;31m" /* 0 -> normal ; 31 -> red */
#define cyan "\033[0;36m" /* 1 -> bold ; 36 -> cyan */
#define green "\033[0;32m" /* 4 -> underline ; 32 -> green */
#define blue "\033[0;34... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.